1. Executive Summary
Evolving Profile (EP) is a local memory control plane built on a fork
of Hindsight. The fork keeps Hindsight's
retain, recall and reflect service over PostgreSQL with pgvector. EP
adds hooks and one MCP server for Claude Code, Codex and other hosts, a
query controller, a scheduler, a web console, and a preference registry
in SQLite. The registry holds conditional rules about how the user wants
work done, in five categories, each tied to quoted user messages
(guidance/schemas.py:9-17).
Notable: a preference is published only on evidence. A model
classifies consolidated observations, a second model checks each
candidate against the original messages, and code admits it only with
two quotes found inside user-role spans, re-hashing the sources before
commit (guidance/publish_observation_guidance.py:292-345).
The scope of a preference read comes from the hook's own prompt-ingress
record, and the caller's ids are stripped
(guidance/context_binding.py:107-115).
Weak: the selector admits only units audited approved or
restricted, and nothing scheduled writes
approved, so what the worker publishes stays withheld until
an operator runs a keyword script. A claim tombstone guards extraction
against overturned observations, but its table exists only after a SQL
script no installer runs. The audit log is off by default, and the
console names a variable the API never reads.
Four marks are present and three are withheld (section 9).
Licence. The licence files disagree for one package:
LICENSE grants MIT for the whole repository, while
console/package.json:32 declares ISC. LICENSE
carries two copyright lines, CCY for the control plane, preference
engine, host adapters and extensions, and the Vectorize / Hindsight
contributors for the upstream foundation, and NOTICE.md
asks that both be kept. AGENTS.md:6 describes the checkout
as a sanitized distribution, not the private runtime it is cut from.
SECURITY.md is a privacy note with no reporting
channel.
2. Mental Model
Two things are remembered, and they become beliefs by different routes.
A fact starts as a turn the Stop hook queues on
disk. When 12,000 tokens have gathered, the batch goes to the retain
API, where a model extracts facts and code binds each to a quote and the
role that said it. A user's quote becomes a world fact; an
assistant's becomes an experience prefixed "Assistant
statement (not user-confirmed)"
(api/evolving_profile_api/engine/retain/source_attribution.py:506-520).
A consolidation model folds facts into observations, and may delete
one.
A preference starts as an observation. The guidance
worker sends changed observations to a model for a disposition, sends
each guidance_candidate to a second model with the original
messages, and publishes those with two verified user quotes as an active
revision. A published unit carries no audit row and reads as
not_reviewed (guidance/repository.py:181). The
selector serves only approved and restricted
units (guidance/recall_first.py:167).
Diagram source
%% caption: a preference reaches the prompt only through an audit state the scheduled worker never writes as approved; the tombstone guard on extraction reads a table no installer creates
flowchart TD
HK["Stop hook:<br/>turns to local queue"] --> RT["Retain API at 12k tokens:<br/>model extracts facts"]
RT --> AT{"Quote bound to<br/>which role?"}
AT -- "assistant" --> AX["experience labelled<br/>not user-confirmed"]
AT -- "user" --> TB{"Tombstone match?<br/>table from manual SQL"}
TB -- "yes" --> DROP["fact dropped"]
TB -- "no or no table" --> MU["memory_units<br/>PostgreSQL"]
MU --> CON["Consolidation model:<br/>observations"]
CON -- "delete or merge" --> TS["tombstone row<br/>if table exists"]
CON --> GW["Guidance worker<br/>every 5 minutes"]
GW --> RV["Model disposition,<br/>model source review,<br/>two user quotes"]
RV --> PUB["Active revision,<br/>no audit row:<br/>not_reviewed"]
OP["Operator script:<br/>keyword rules"] --> AUD{"Audit state"}
PUB --> AUD
AUD -- "approved or<br/>restricted" --> SEL["Selector:<br/>scope, topic, lexical"]
AUD -- "not_reviewed or<br/>needs_review or<br/>superseded" --> HOLD["never selected"]
SEL --> UP["UserPromptSubmit<br/>additionalContext"]3. Architecture
Five processes and two stores. The memory API is the Hindsight fork
(api/evolving_profile_api), FastAPI over PostgreSQL with
pgvector, with its own consolidation and an opt-in audit table. The
query controller (controller/controller.py, 9,848 lines)
sits in front of recall on port 12079 and applies conflict arbitration
and trust sorting. A model router and a pure-Python scheduler
(v6/daemon.py) run beside them. The console is a Next.js
application, and status/evolving_profile_status_server.py
serves guidance status and the admin routes.
The guidance registry is one SQLite file per bank, opened through
guidance/mcp_runtime.py:113-115, with tables for
publications, unit revisions, audits, model revisions, jobs and
idempotency keys (guidance/repository.py:31-71). It is a
control registry over the bank, and its module's first line says
Hindsight remains the source of knowledge and source text.
Deployment and ergonomics
scripts/install.py builds a local installation, and the
README asks for Python 3.11, Node 20.9, PostgreSQL with pgvector and the
user's own chat and embedding provider. Every service binds to
127.0.0.1. Host integration is per host: a Claude Code
Desktop plugin whose hooks.json registers session, prompt,
tool, compaction and stop hooks, CLI hooks, Codex hooks and bridges for
other MCP hosts. A host without a native retain hook reaches the bank
through a ledger bridge job (v6/daemon.py:317-318).
4. Essential Implementation Paths
- Capture. The Stop hook runs
host-adapter/retain.py, which queues turns and submits a batch once it reachesretainTokenThreshold, 12,000 by default (host-adapter/retain.py:352,:419,:482), as an async retain (host-adapter/lib/client.py:192,:208). - Extraction guard. After embedding, retain drops
extracted facts that match a tombstone in the same tag scope
(
api/evolving_profile_api/engine/retain/orchestrator.py:1266-1275). - Preference rebuild.
guidance/guidance_worker.py:71-116runs every 300 seconds (v6/daemon.py:312):observation_rebuild.pyfor dispositions,publish_observation_guidance.pyfor source review and publication, then model rebuild and duplicate consolidation. - Publication.
prepare_publicationvalidates scope, the proposal contract and the review contract;commit_publicationactivates under an owner token and an expected-revision check (guidance/publisher.py:14-40,guidance/repository.py:141-164). - Read. The UserPromptSubmit hook runs
host-adapter/recall.py, which calls the controller for facts andguidance_entry.pyfor preferences, both intoadditionalContext(host-adapter/recall.py:374,host-adapter/guidance_entry.py:232-245). The MCP tooluser_preferencereaches the same selector (guidance/selector.py:223-225). - Correction. The console's manual correction writes
a new revision and copies the prior audit
(
host-adapter/lib/preference_correction.py:9-47); the status server's withdraw route deactivates a revision (status/evolving_profile_status_server.py:2457-2460).
5. Memory Data Model
The fact model is Hindsight's: memory_units with a
fact_type, text, occurred_start,
occurred_end, mentioned_at, tags, metadata,
source ids and an embedding, plus an
invalidated_memory_units archive that curation moves an
invalidated fact into
(api/evolving_profile_api/engine/memories/pg/curation.py:1-15).
EP adds superseded_by_id and
supersession_scope columns and a
superseded_claim_tombstones table, all in
scripts/migrate_6_2_3_supersession.sql:4-25.
A preference proposal carries an id, a nature (declared preference,
explicit requirement, inferred pattern or task-local), a primary
category, text, applies_when, exceptions,
effect_on_action, a scope object, evidence references and
source family ids (guidance/schemas.py:58-104). Each
evidence reference names the bank, memory, document, source revision and
hash, the quote and its span, the stored role and the origin; a role
other than user or an origin of
agent_generated holds the proposal.
unit_revisions keeps every revision of a unit, one
active. A trigger refuses an edit to an active revision's payload and a
scope that is not an object (guidance/repository.py:58-71).
unit_audits is keyed on unit and revision, with a state,
scope level, validity kind, reason and superseded_by; its
states are approved, restricted,
needs_review, superseded and
stale (:184-190).
ep_events.entity_state holds a status per project,
service, client or config key, with valid_from,
valid_to and superseded_by
(v6/entity_state.py:16-28). Both timestamps come from the
database clock when the hourly job sees a status change
(:60-126), so the interval is record time.
6. Retrieval Mechanics
Fact recall is Hindsight's four arms, each with an unconditional bank
predicate
(api/evolving_profile_api/engine/sql/postgresql.py:272,
:351). The controller's post-pass sorts results flagged as
unconfirmed assistant statements, fragments or demoted rows to the end
and attaches entity-state hints by substring match
(controller/controller.py:8160-8205). It ranks them down;
it does not remove them. ep_exhaustive_search pages the
whole bank by date and keyword for inventories, and widens to every
non-test bank on an agent's boolean
(host-adapter/lib/exhaustive_query.py:345-353).
Preference selection is lexical first. select drops
units with inject_default false or out of scope, then
rank keeps approved and
restricted units, applies platform, named-product, domain
and declined-topic gates written as Chinese and English keyword lists,
and scores intent overlap plus IDF-weighted term similarity
(guidance/recall_first.py:152-235, :325-350).
Hard guardrails sort first. A local embedding service may add at most
two semantic candidates above a centered-cosine floor, and drops a weak
lexical match it contradicts (:279-312).
Scope comes from the binding. bind_preference_request
discards any session, project, task or role id in the caller's task and
refills session, project and task from the prompt-ingress record
matching the call's check_id
(guidance/context_binding.py:107-115). A binding that is
unknown, ambiguous or stale adds nothing, and every scoped unit then
falls to scoped_out
(guidance/recall_first.py:140-150).
7. Write Mechanics
Capture never blocks the agent: hooks exit 0 on every error
(claude-code/hook_bridge.py:13-15), and turns sit in a
local queue until a batch is due. The lag before a fact is recallable is
the queue threshold plus async extraction. A preference lags further:
the five-minute worker, two model passes, and then an audit that nothing
schedules.
Extraction is a model call; attribution is code. The source review is
a model call; the quote check is code, and so is the rule that an
inferred pattern needs two independent task contexts
(guidance/observation_publish.py:513-555). A pattern seen
twice in one task is published as task-local, scoped to that session or
task.
Background rewrites
v6/ontology_hygiene.py runs daily with
--apply. It deactivates every active unit whose audit is
superseded and rewrites every other unit whose scope or
enforcement classification changed as a new revision, carrying the audit
over (v6/ontology_hygiene.py:131-204). The classification
is keyword lists, so a change to those lists re-revisions the
registry.
Operational cost
Every retain batch and every changed observation costs a model call;
the worker calls the reviewer models in batches of eight and four
(guidance/observation_rebuild.py:222,
guidance/publish_observation_guidance.py:243). The 6.2.4
release adds a daily token budget with a downgrade to a local 4B model
(CHANGELOG-6.2.md:5-14).
8. Agent Integration
The stdio MCP server lists up to 36 tools: user recall and research,
source reads, exhaustive search, preference reads, task state, scenario
summaries, external RAG and a family of agent process-memory tools
(host-adapter/evolving_profile_controller_mcp.py:2709).
Among them is promote_agent_process_memory, which promotes
the agent's own traces into episodes, patterns and skills
(:313-331, :2822-2823). No tool writes or
audits a preference unit.
Delivered guidance carries its own precedence: the current prompt,
then current authoritative sources, then tool results and permissions,
then the preference, which may not authorize an action
(guidance/selector.py:324-334). The recall hook records a
receipt per injection under ~/.evolving-profile/audit.
9. Reliability, Safety, and Trust
The gate nothing scheduled opens
The worker publishes active revisions and writes no audit row, so its
units read as not_reviewed and every selection path skips
them. Two things write approved:
guidance/audit_active_preferences.py, a keyword pass that
sets needs_review on method, temporal or product-state
wording, restricted on paths and project names, and
approved otherwise (:33-75); and
guidance/codex_publish_60d.py:108, which publishes a
hard-coded batch. The scheduler, the installer, the console and the
status server call neither (recorded
searches). The withholding is real; the release is an operator
running a script, and the script that releases most is keyword
rules.
A tombstone without a table
record_supersession stores the deleted observation's
text with its tag scope and effective time, and retain drops a new fact
within 0.62 similarity of it in the same scope unless the fact is dated
after it
(api/evolving_profile_api/engine/memories/supersession.py:69-144).
The shape is a value tombstone. The table and the columns it updates are
created only by scripts/migrate_6_2_3_supersession.sql,
which no Alembic revision, installer or startup path runs, and both the
write and the read swallow the error
(api/evolving_profile_api/engine/consolidation/consolidator.py:3064-3065,
supersession.py:162-164). The curation queries name the
same columns (curation.py:251, :353).
The only writer is consolidation's own delete, and both callers pass
no replacement id or reason (consolidator.py:589,
:2460). One of them is the dedup merge, so a duplicate
folded into a surviving observation leaves a tombstone of a claim the
store keeps. A user's delete or correction writes none.
Assistant statements
Assistant-sourced facts are kept, prefixed and sorted last, and the
preference rebuild drops observations built only from them before any
model call (guidance/observation_rebuild.py:164-175).
Preference evidence must be a user-role quote
(guidance/schemas.py:51-54). Facts are not filtered by
origin at recall.
Marks
trust_state— present. Audit states withhold a unit from every selection path; no scheduled writer grantsapproved.scope_enforced— present. Unit scope lists against ids bound from the hook's record, and the inherited bank predicate.audit_log— present. The inherited opt-inaudit_logtable of API operations, off by default; the profile registry is outside it.negative_eval— present. A declined topic absent beside a returned rule, and a session-scoped unit absent outside its session with a positive control.tombstone— withheld. Keyed on the claim text and consulted at extraction, but its table exists only after an unrun SQL script, the error is swallowed, and only consolidation writes one.human_review— withheld.not_reviewedwaits, but the actors that clear it are a keyword script and a fixed batch, and no console or status route sets an audit state. Agent process memory is promoted by the agent's own tool.bitemporal— withheld.entity_statestamps both ends from the database clock when a job sees a change; facts keep Hindsight's event and mention times with no validity interval.
10. Tests, Evals, and Benchmarks
The tree holds 7,416 Python test functions, 5,324 of them in
api/tests, and 543 console and client test cases. The one
workflow runs host-integration preparation on manual dispatch
(.github/workflows/host-integrations.yml). I ran none of
them.
The preference selector is the best-tested part of EP.
guidance/test_recall_first.py pins topic leakage case by
case, and :104-116 asserts that a prompt declining a PPT
returns the web rule and not the PPT rule, though both sit near the
query vector. guidance/test_observation_task_scope.py:77-87
asserts a session-scoped unit absent with no session and with another
session, then present with its own. The lifecycle case at
test_recall_first.py:285-289 asserts an empty result with
no control. All run against an in-memory stub of the repository.
controller/test_conflict_arbitration.py:38-115 pins the
tombstone match: blocked when reworded in scope, kept in another scope
or when dated after. It calls the pure functions, so it says nothing
about the table. The files the triage flagged,
status/test_memory_map.py,
status/test_prompt_origin.py and
scripts/test_install_ep51.py, test the console's memory
map, prompt-origin classification and the installer, not retrieval.
The committed benchmark results recompute: 35 of 37 on PersonaMem-32K
at a mean of 31,820 context tokens per question, and 11 of 12 on
LongMemEval-S at 23,851
(benchmarks/results/personamem_32k_ep_sota_gemini4_37q.json,
benchmarks/results/longmemeval_s_ep_sota_12q.json). Both
are small samples. No paper describes EP;
docs/EP5.0-AGENT-PROCESS-MEMORY-PRD.md:40-49 cites related
work.
11. For Your Own Build
Steal
- Publish a belief only with quotes code can find. A model proposes and a second model reviews, but admission is two verified spans in user-role messages and a re-hash of each source before commit.
- Bind scope from your own record of the turn. Strip the caller's ids and look up the hook's ingress record by a check id; a stale binding scopes out instead of scoping wide.
- Count independence by task, not by message. Two turns of one session are one vote, so a request repeated inside a task becomes task-local.
- Refuse in-place edits of the active revision in the store, with a trigger every writer passes through.
Avoid
- Do not gate selection on a state no scheduled path writes. Either the pipeline sets it or a person does through a surface; an operator script is neither.
- Do not create a guard's table outside the migrations that build the database, and do not swallow the error when it is missing.
- Do not write a tombstone on a merge. A duplicate folded into a survivor was not overturned.
- Do not tell the user to set a variable the service does not read.
Fit
Fits one person who works across several coding agents on one machine, wants their working preferences carried between them with the evidence on hand, and can operate PostgreSQL, a model provider, a scheduler and 16 jobs. The preference publication and scope binding are worth reading whatever the product.
Walk away if several people share an installation, if a person must approve what the agent is told, or if a correction must be guaranteed to stop a value returning. The codebase is large, mostly one author's, and by its own account a sanitized cut of a private runtime.
12. Open Questions
- Whether the running installation schedules
audit_active_preferences.py --applyoutside this tree, given that the shipped scheduler does not. - Whether
migrate_6_2_3_supersession.sqlis meant to become an Alembic revision, given that curation selects the columns it adds. - Whether a dedup merge is meant to write a tombstone at all.
Appendix: File Index
- Preference registry and publication:
guidance/repository.py,guidance/schemas.py,guidance/publisher.py,guidance/observation_publish.py,guidance/observation_rebuild.py,guidance/publish_observation_guidance.py,guidance/guidance_worker.py,guidance/consolidate_units.py - Audit writers:
guidance/audit_active_preferences.py,guidance/codex_publish_60d.py - Selection:
guidance/recall_first.py,guidance/selector.py,guidance/context_binding.py,guidance/semantic_recall.py,guidance/profile_projection.py,host-adapter/guidance_entry.py - Capture and recall hooks:
claude-code/hook_bridge_desktop.py,claude-code/desktop-plugin/ep-desktop-bridge/hooks/hooks.json,host-adapter/retain.py,host-adapter/recall.py,host-adapter/lib/client.py - Correction:
host-adapter/lib/preference_correction.py,console/src/app/api/evolving-profile/guidance/manual-correction/route.ts,status/evolving_profile_status_server.py - Tombstone:
api/evolving_profile_api/engine/memories/supersession.py,api/evolving_profile_api/engine/consolidation/consolidator.py,api/evolving_profile_api/engine/retain/orchestrator.py,scripts/migrate_6_2_3_supersession.sql - Attribution:
api/evolving_profile_api/engine/retain/source_attribution.py - Scheduler and jobs:
v6/daemon.py,v6/ontology_hygiene.py,v6/entity_state.py - Controller:
controller/controller.py - Audit log:
api/evolving_profile_api/engine/audit.py,api/evolving_profile_api/config.py - MCP server:
host-adapter/evolving_profile_controller_mcp.py - Tests:
guidance/test_recall_first.py,guidance/test_observation_task_scope.py,controller/test_conflict_arbitration.py
Recorded searches
Run from the repository root at the pinned commit with
/usr/bin/git grep.
- No caller of the approving scripts.
git grep -n -E 'audit_active_preferences|codex_publish_60d'returns onlyguidance/test_recall_first.py:239, an import ofaudit_unit. - Every audit-row writer.
git grep -n -E 'INSERT INTO unit_audits|set_unit_audit\(' -- ':!*test_*'returnsguidance/audit_active_preferences.py:85,guidance/codex_publish_60d.py:108,guidance/publisher.py:94(aneeds_reviewhold),guidance/repository.py:184,:189,:202(supersession), and two carry-overs of a prior audit,host-adapter/lib/preference_correction.py:41andv6/ontology_hygiene.py:202. - The tombstone table is not in a migration.
git grep -n -F 'superseded_claim_tombstones'returnsapi/evolving_profile_api/engine/memories/supersession.py:101,:153and the SQL script;git grep -n -F 'superseded_claim_tombstones' -- api/evolving_profile_api/alembicreturns nothing. - Nothing runs the SQL script.
git grep -n -F 'migrate_6_2_3_supersession' -- '*.py' '*.sh' '*.ps1' '*.zsh' '*.ts' '*.json'returns nothing; the name appears only inCHANGELOG-6.2.md:27anddocs/RELEASE-LEDGER.md:18. - The console's audit variable is unread.
git grep -n -F 'HINDSIGHT_API' -- 'api/evolving_profile_api/*.py' 'api/evolving_profile_api/**/*.py'returns nothing; the API readsEVOLVING_PROFILE_API_AUDIT_LOG_ENABLED(api/evolving_profile_api/config.py:866). - No paper.
CITATION.cffis absent;git grep -n -i -E 'arxiv|doi\.org|bibtex' -- . ':!package-lock.json'returns only the related-work list indocs/EP5.0-AGENT-PROCESS-MEMORY-PRD.md:40-49. - No submodules.
.gitmodulesis absent.
History
2026-12-03 — 8e4441d6….
First reading, from the 2026-12-03 triage shortlist, at the head of
main. Screened: three auto-run surfaces, all in the nested
Claude Code plugin under
claude-code/desktop-plugin/ep-desktop-bridge/ (its
manifest, hooks/ and hooks/hooks.json,
registering SessionStart, UserPromptSubmit, PreToolUse, PostToolUse and
Stop hooks). The screen also found three build-time execution points
(api/tests/conftest.py and prepublishOnly
scripts in console/package.json and
evolving-client/package.json); six dependency surfaces
inside the cooldown, inflated by the depth-1 clone; three unpinned
surfaces, including a file: dependency and 54 floating
ranges in console/package.json with no lockfile beside it.
Nothing was installed, built or run. Four marks (section 9).