An autonomous agent whose memory passes quarantine, a scanner and trust tiers before it is believed

Milyonus Agent

An Apache-2.0 self-improving Python agent whose memory candidates pass a quarantine, a scanner and tier rules before promotion, under a hash-chained SQLite ledger.

LicenceApache-2.0 in LICENSE and pyproject.toml; NOTICE and TRADEMARK.md withhold the name and mark
Size11,368 lines of Python in 123 files under src, of which the memory package is 2,301 lines in 16 files; 1,119 lines of evals and 5,487 lines of tests
Activity66 commits dated 26 August to 3 December 2026 under three author names, 38 under the maintainer's account; the GitHub repository was created on 26 August; version 5.5.0
Tests307 pytest functions in 48 files, among them the ten multi-step PoisonBench scenarios run as one parametrized test; CI runs pytest after ruff on Ubuntu; none run here

Carries 5 of 7 rubric mechanisms. Most systems here carry none or one (41%), and a dash means the mechanism was not found at this commit — not that the system needed it. Each mark is one LLM reviewer's reading of the code at this commit rather than a run of it — known limits.

  • Tombstone
  • Trust state
  • Bi-temporal
  • Scope enforced
  • Mutation audit
  • Human review
  • Negative evals

1. Executive Summary

Milyonus Agent is an open-source autonomous agent in Python: a terminal TUI, a chat gateway for four messengers, an editor server over ACP and a stdio MCP server, all sharing one SQLite file per install. Its memory is a table of text lines, each with a trust tier derived from its source kind. Every candidate is inserted pending and reaches active only through one pipeline: a check against previously rejected text, an injection scanner, a source-competence rule, and the tier's promotion rule.

Notable: the pipeline is the only insert path, and every state change appends to a SHA-256 hash chain. Erasure blanks the text, removes the vector and the matching negative-memory text, and keeps the chain verifiable. Recall is ranked by cosine times a trust score that halves with time since the last reaffirmation.

Weak: the model names the source kind that decides its own tier, and the gateway, ACP and MCP server verify with the regex layer alone. The revoke cascade has no producer on the agent's own write path.

Five marks are present and two are withheld (section 9).

Licence. Apache-2.0 in LICENSE, declared again in pyproject.toml:7-8, with no rider. NOTICE reads Copyright 2026 Milyonus and states that the grant does not cover the name or the star mark, which TRADEMARK.md governs. SECURITY.md asks for vulnerabilities to go through GitHub Security Advisories or e-mail, and not a public issue.

2. Mental Model

A memory is a claim with a source, and the source decides how much evidence it needs. SOURCE_DEFAULT_TIER maps operator to T0, user-direct to T1, agent-observed to T2, third-party to T3 and subagent or unknown to T4 (src/milyonus/memory/model.py:70-77). The tier is computed from the source kind at proposal time (src/milyonus/memory/pipeline.py:81).

State is separate from tier. pending, active, rejected, revoked, expired, superseded, t0_staged and erased are the eight values (src/milyonus/memory/model.py:23-32), and every read the agent receives asks for active (src/milyonus/memory/store.py:640-667).

Belief also wears off. A promoted row's trust is its ceiling times 0.5 ** (age / half_life), with half-lives of 180 days for T1, 60 for T2 and 14 for T3 and T4, a quarter of that for text containing words such as approve, token or deploy, and none for T0 (src/milyonus/memory/trust.py:19-53, :59-90, src/milyonus/config/schema.py:42-66). Below 0.25 the consolidation pass returns the row to pending (src/milyonus/memory/consolidate.py:62-77).

Diagram — every candidate enters pending; rejected text is checked first, then the scanner, then the tier rule; reads take active rows only
Diagram source
%% caption: every candidate enters pending; rejected text is checked first, then the scanner, then the tier rule; reads take active rows only
flowchart TD
    SRC["memory_propose, MCP propose,<br/>user-model reflection"] --> P["insert_candidate<br/>state pending"]
    P --> NEG{"Jaccard 0.86 against<br/>negative_memory?"}
    NEG -- "match" --> R1["rejected<br/>no new negative row"]
    NEG -- "no match" --> V{"scanner and<br/>source competence;<br/>model verifier in TUI"}
    V -- "fail" --> R2["rejected, text added<br/>to negative_memory"]
    V -- "pass" --> T{"tier from<br/>source kind"}
    T -- "T1 or T2" --> ACT["active<br/>trust 1.0"]
    T -- "T3" --> WAIT["pending until<br/>confirmation count"]
    T -- "T4" --> STUCK["pending; approval<br/>has no product caller"]
    WAIT --> ACT
    ACT --> READ["snapshot, search,<br/>recall: active only"]
    ACT --> DEC["consolidate: trust<br/>below 0.25"]
    DEC --> DEM["pending<br/>demoted"]
    OP["operator Ed25519 key,<br/>admin CLI"] --> T0["t0_staged, then active<br/>after second signature"]
    T0 --> READ

3. Architecture

src/milyonus/memory/ holds the store, the pipeline, the verifiers, negative memory, trust decay, consolidation, the user model, the embedder and vector index, the snapshot renderer, export and the agent tool. One MemoryStore opens state.db under MILYONUS_HOME or ~/.milyonus, in WAL mode, and creates memory, memory_ledger and negative_memory (src/milyonus/memory/store.py:37-85, :119-128). VectorIndex adds memory_vector to the same file (src/milyonus/memory/vector.py:23-31).

The agent hosts are separate entry points over that store: src/milyonus/cli/tui.py, src/milyonus/gateway/server.py, src/milyonus/acp/server.py and src/milyonus/mcp/server.py. The operator surface is the milyonus memory, milyonus audit and milyonus admin commands (src/milyonus/cli/memory_cmd.py, src/milyonus/cli/admin_cmd.py).

src/milyonus/tenancy.py:50-80 opens one home per tenant on an explicit path, and ADR-011 describes it as the boundary for a future web process; nothing in src calls open_tenant.

Deployment and ergonomics

uv tool install milyonus-agent, then milyonus setup to choose a provider. The default embedder is feature hashing with no model or network (src/milyonus/memory/embed.py:1-20, src/milyonus/config/schema.py:78), so semantic recall works offline as a lexical vector. The operator key pair is generated by the admin CLI; only the public key is installed in the home (src/milyonus/security/operator.py:22-67).

4. Essential Implementation Paths

  • Propose. The agent's memory_propose accepts user-direct or agent-observed and otherwise falls back to the host's default, stamps the session and the host's user reference as actor, and calls process_one (src/milyonus/memory/tool.py:25-46).
  • Insert. insert_candidate writes pending, the evidence hash and a sensitivity label, and appends ingest (src/milyonus/memory/store.py:206-245).
  • Verify and promote. process_one: negative-memory check, verifier, tier rule (src/milyonus/memory/pipeline.py:101-164).
  • Inject. build_snapshot at session start, rendered inside a <milyonus:memory> fence under a rule that memory is observation and not instruction (src/milyonus/memory/render.py:42-61, src/milyonus/prompt/builder.py:21-51).
  • Search. memory_search tries SemanticMemory.recall, then a substring match over active rows (src/milyonus/memory/tool.py:48-67).
  • Revoke. revoke_by_source walks source_uri, then derived_from breadth-first, and revokes active and pending rows (src/milyonus/memory/store.py:388-401, :436-473).
  • Erase. erase tombstones one row in one transaction (src/milyonus/memory/store.py:509-570).
  • Consolidate. consolidate: process pending, expire, decay, deduplicate, list contradictions (src/milyonus/memory/consolidate.py:47-105).

5. Memory Data Model

  • memory: id, content, trust_tier, state, provenance (source_kind, source_uri, session_id, turn_id, actor), evidence_hash, created_at, verified_at, verdict, confirmations, expires_at, superseded_by, derived_from, trust_score, last_reaffirmed_at, review_at, reaffirm_count, signature, key_fingerprint, trust_ceiling, sensitivity (src/milyonus/memory/store.py:38-64).
  • memory_ledger: seq, prev_hash, entry_hash, action, item_id, JSON detail, created_at (:68-76).
  • negative_memory: id, content, reason, source_uri, created_at (:78-84).
  • memory_vector: one vector per id, with the embedder's signature (src/milyonus/memory/vector.py:23-31).

evidence_hash is SHA-256 over the text and the five provenance fields (src/milyonus/memory/store.py:102-116). Every time column is a system time: when the row was written, verified, last reaffirmed, due for review or due to expire. None records when the claim held; ROADMAP-30D.md:60 lists valid_from and valid_to as a planned item.

Three columns are read and never written by product code. Nothing passes derived_from or turn_id to propose, and nothing writes superseded_by or the superseded state (recorded searches).

6. Retrieval Mechanics

The snapshot is built once per session. It splits active rows into a user profile (sources user-direct and operator) and agent notes (every other source), sorts each by tier and then recency, and packs lines until 1,400 and 2,200 characters (src/milyonus/memory/render.py:24-61, src/milyonus/config/schema.py:86-87). With a user_ref, the profile half reads that actor's rows only; agent notes read every active row.

SemanticMemory.recall embeds the query, restricts the vector scan to the ids of the active set, or of one actor's active set, over-fetches three times k, and re-ranks by cosine * current_trust (src/milyonus/memory/semantic.py:94-131). The vector scan is a Python dot product over every stored vector of the same embedder (src/milyonus/memory/vector.py:91-110). When recall returns nothing, search falls back to a case-insensitive substring match.

Every one of these reads goes through by_state, whose default is the 200 newest rows (src/milyonus/memory/store.py:640-648, :658-667). Past 200 active rows, the oldest are absent from the snapshot, from recall's allowed set, from the verifier's existing list and from consolidation's decay and deduplication loops (src/milyonus/memory/pipeline.py:89, src/milyonus/memory/consolidate.py:63, :80).

The MCP search tool returns the same active set with tier, source kind and current trust per hit (src/milyonus/mcp/server.py:343-375).

7. Write Mechanics

Writes block the turn. memory_propose inserts, verifies and promotes inside the tool call, so a T1 or T2 row is retrievable on the next search in the same session; the snapshot, built at session start, shows it from the next session. The TUI also reflects at session end: user messages matching self-description cues (my name, call me, I'm based) are proposed as user-direct (src/milyonus/memory/usermodel.py:117-156, src/milyonus/cli/tui.py:279-293).

The proposer chooses the tier. The agent tool accepts source_kind of user-direct or agent-observed and describes the first as "if the user said it directly" (src/milyonus/memory/tool.py:31-33, :101-105). The gateway sets third-party as the default for group chats, which applies only when the model omits the argument (src/milyonus/gateway/server.py:96-103). The MCP propose accepts every kind except operator, plus a free source_uri and actor (src/milyonus/mcp/server.py:416-467).

The verifier differs by host. The TUI builds a ModelVerifier on the configured cheap model over the rule verifier (src/milyonus/cli/tui.py:118-132). The gateway, the ACP server, the MCP server and memory consolidate construct MemoryPipeline with no verifier, which means RuleBasedVerifier alone (src/milyonus/gateway/server.py:95, src/milyonus/acp/server.py:141, src/milyonus/mcp/server.py:251-253, src/milyonus/cli/memory_cmd.py:302, src/milyonus/memory/pipeline.py:46). The rule verifier is a set of regexes for overrides, imperatives, credentials, authority grants and invisible characters, plus a keyword test that bars untrusted sources from claims about the user or the agent's policy (src/milyonus/security/injection.py:29-131, src/milyonus/memory/verifier.py:40-84).

T3 rows that are not promoted get an expires_at 14 days out (src/milyonus/memory/pipeline.py:158-162). expire_due selects only active rows with an expiry (src/milyonus/memory/store.py:475-487), so an unconfirmed third-party row stays pending, and a T3 row promoted later keeps the expiry its pending pass set.

Operational cost

A proposal costs one model call in the TUI and none elsewhere, plus one embedding of the promoted text. Every proposal compares the candidate with every negative-memory row, and the model verifier receives up to 20 active texts as context (src/milyonus/memory/verifier.py:124-127).

8. Agent Integration

Each agent host registers three memory tools: memory_propose, memory_search and user_recall (src/milyonus/memory/tool.py:90-140). None promotes, rejects, revokes, erases or reaffirms, and a test asserts that no reaffirm, T0 or admin tool is in the registry (tests/test_t0.py:45-56). The three are declared risk="safe", so the risk engine runs them without asking unless an argument contains a word such as delete or send (src/milyonus/memory/tool.py:110, :121, :138, src/milyonus/security/risk.py:62-94).

The MCP server exposes search, why, pending, propose and revoke_preview; its docstring states that it has no revoke and no erase (src/milyonus/mcp/server.py:7-20). why returns a row's provenance and its ledger entries with a chain check.

Operators work at the CLI: memory list, pending, why, diff, revoke, erase, search, reindex, consolidate, reaffirm, review, stats and export, and audit verify and audit log (src/milyonus/cli/memory_cmd.py:44-452).

9. Reliability, Safety, and Trust

Revocation reaches what carries a source URI

memory revoke --source <uri> is the README's poison cleanup (README.md:54, :266). The cascade matches source_uri and then derived_from (src/milyonus/memory/store.py:436-473). memory_propose passes neither (src/milyonus/memory/tool.py:34-39), and no caller anywhere passes derived_from. On the TUI, the gateway and ACP, a fact the agent drew from a web page is stored with no URI to revoke it by. The MCP propose is the one path that stores a URI, and the URI is whatever the caller supplies.

T4 waits for an approval nobody can give

The README says T4 promotes on "user approval only" (README.md:259). approve_pending exists (src/milyonus/memory/pipeline.py:174-182) and its only caller is a test (tests/test_memory_pipeline.py:64). memory pending and memory review display; no command promotes a pending row. A subagent or unknown-source candidate stays pending and is never served.

Erasure keeps the chain and loses the text

erase blanks content, verdict, signature, source_uri, actor and session_id, keeps the id, tier and evidence hash, deletes the vector in the same transaction, blanks every negative-memory row with the same text, and appends erase and erase_negative rows holding only hashes (src/milyonus/memory/store.py:509-570). The ledger never held text, so it verifies after erasure (docs/adr/0012-web-erasure-vs-ledger.md). Blanking the negative row also lifts the rejection the erased text carried; ADR-012 chooses that.

The ledger detects edits, not a rewrite

The chain starts from 64 zeros and hashes prev_hash with the canonical JSON of action, item, detail and timestamp (src/milyonus/memory/store.py:157-190). No key, signature or external head is kept, and nothing below the application prevents an update or delete, so a writer with the file can rebuild a valid chain. add_confirmation, set_expiry, update_trust_score and add_negative change state without a ledger row (:381-382, :489-491, :572-593).

Scope is an actor inside one install

ADR-011 states the design: channel users of one gateway are actors, not tenants, and recall without an actor is global, which it calls correct for a single-operator install (docs/adr/0011-web-tenancy.md). The actor is msg.user_id, while the session key includes the channel (src/milyonus/gateway/server.py:88-89, :101), so the same numeric id on two messengers is one actor. The TUI and ACP use the constants local and editor (src/milyonus/cli/tui.py:173, src/milyonus/acp/server.py:152).

The shell

The agent's run_shell runs as the same OS user that owns state.db. It is always confirmed at least once, and a session grant can lift that for commands without an irreversible keyword (src/milyonus/security/risk.py:27, :77-94). No memory verb is on the tool surface; the database file is reachable through a general shell.

Marks

  • tombstone — present. A verifier's rejection stores the text, and every pipeline path compares each later candidate with it before verifying. Only the verifier writes it; a third party's rejected wording also refuses the user's own.
  • trust_state — present. Eight states; every read takes active. The proposer chooses the source kind behind its own tier.
  • scope_enforced — present. The actor filters the user-profile block and user recall; agent notes and search are global by ADR-011.
  • audit_log — present. Every state change appends to a hash chain; four writers change counters, expiry, trust and negative memory without a row.
  • negative_eval — present. Populated cases for another user's profile and for a quarantined row worded to match.
  • bitemporal — withheld. Every timestamp is a system time; validity is a roadmap item (ROADMAP-30D.md:60).
  • human_review — withheld. T4 rows wait in pending and the approval that would resolve them has no caller outside a test. T0 has a real two-step gate behind an Ed25519 key the agent does not hold (src/milyonus/memory/t0.py:37-75), but it gates memory the operator writes, not memory the agent produced. reaffirm is CLI-only and renews trust on a row; it resolves no waiting state.

10. Tests, Evals, and Benchmarks

The suite is pytest, 307 functions in 48 files, run in CI after ruff lint and format checks with the dev, admin and discord extras (.github/workflows/ci.yml). Memory coverage sits in test_memory_store.py, test_memory_pipeline.py, test_trust.py, test_consolidate.py, test_vector.py, test_usermodel.py, test_t0.py, test_memory_erase.py, test_memory_export.py, test_tenant_isolation.py and test_mcp_server.py. The T0 tests skip without cryptography (tests/test_t0.py:18).

tests/test_poison_scenarios.py runs the ten multi-step PoisonBench scenarios and fails on any breached (tests/test_poison_scenarios.py:14-27). Two of them are contained by the scanner rather than by the defence they are named for: the five-source consensus text contains "without asking", an authority-grant pattern, and the second phrasing in the rephrase scenario matches the override pattern on its own (evals/poisonbench/scenarios.py:133-155, :307-325, src/milyonus/security/injection.py:31, :62). The direct rephrase test lowers the threshold to 0.5 (tests/test_memory_pipeline.py:67-80).

The single-shot PoisonBench proposes each of 40 attacks into an empty store (evals/poisonbench/run.py:55-72). docs/benchmarks.md:35-36 reports a held-out attack success rate of 75.0% with the rule verifier and 0.0% with the model verifier added, on 8 attacks and 4 benign controls. No result file is committed. The rule-only configuration is the one the gateway, ACP and MCP paths run.

I ran none of them. No paper describes the system: CITATION.cff is absent and no arxiv, doi.org or bibtex string occurs in the tree.

11. For Your Own Build

Steal

  • Make the insert function unable to write the trusted state. One insert that always writes pending, and promotion only through the function that checks, is a property a reviewer can verify in one file.
  • Rank by decayed trust. cosine * trust with a per-tier half-life and a faster one for authority-shaped text keeps a stale grant from topping recall without deleting it.
  • Erase the text, keep the commitment. A tombstone that blanks the body, the vector and the negative copy, and keeps the id and the evidence hash, satisfies a deletion request and an append-only ledger together.
  • Put the operator tier behind a key the agent host does not hold, with two signatures and a minimum gap between them.

Avoid

  • Do not let the proposer name its own source. A tier derived from an argument the model fills is a tier the model chooses; derive it from the channel the text arrived on.
  • Do not ship the strong verifier on one host only. The benchmark's own rule-only row is the configuration three of the four hosts run.
  • Do not advertise a cascade whose key nothing writes. Stamp the URI of every fetched page onto what the agent proposes from it, or revoke-by-source reaches nothing.
  • Do not let a display default cap a maintenance loop. A limit of 200 newest rows is reasonable for memory list and wrong for decay.

Fit

Fits one operator who runs the TUI with a model verifier configured, wants an agent that refuses obvious injected instructions as memory, and wants every change to memory traceable to a ledger row and an evidence hash. The code is compact and readable, and the decay and erasure designs are worth reading whatever the product.

Walk away if several people share a gateway and must not see each other's memory, if poisoned content must be revocable by where it came from, or if a person must review what the agent writes before it is believed.

12. Open Questions

  • Whether approve_pending is meant to gain a CLI command, since the README promises user approval for T4.
  • Whether the agent tool's user-direct option is meant to stay model-chosen on channels where the host knows the sender.
  • Whether pending T3 rows are meant to expire, given that expire_due selects only active rows.
  • Whether the model verifier is meant to reach the gateway and the MCP server.

Appendix: File Index

  • Memory: src/milyonus/memory/store.py, pipeline.py, model.py, verifier.py, negative.py, trust.py, consolidate.py, t0.py, semantic.py, vector.py, embed.py, render.py, tool.py, usermodel.py, export.py
  • Prompt: src/milyonus/prompt/builder.py
  • Security: src/milyonus/security/injection.py, operator.py, risk.py
  • Hosts: src/milyonus/cli/tui.py, src/milyonus/gateway/server.py, src/milyonus/acp/server.py, src/milyonus/mcp/server.py
  • Operator CLI: src/milyonus/cli/memory_cmd.py, src/milyonus/cli/admin_cmd.py
  • Tenancy: src/milyonus/tenancy.py, docs/adr/0011-web-tenancy.md
  • Erasure: docs/adr/0012-web-erasure-vs-ledger.md
  • Config: src/milyonus/config/schema.py
  • Evals: evals/poisonbench/run.py, attacks.py, scenarios.py, docs/benchmarks.md
  • Tests: tests/test_memory_pipeline.py, test_trust.py, test_vector.py, test_usermodel.py, test_mcp_server.py, test_memory_erase.py, test_t0.py, test_tenant_isolation.py, test_poison_scenarios.py

Recorded searches

Run from the repository root at the pinned commit with /usr/bin/git grep. .gitmodules is absent.

  • The T4 approval has no product caller. git grep -n 'approve_pending' -- . returns the definition at src/milyonus/memory/pipeline.py:174 and tests/test_memory_pipeline.py:64.
  • Nothing sets derived_from or turn_id. git grep -n -F 'derived_from=' -- src returns the pass-through at src/milyonus/memory/pipeline.py:83 and the cascade query at src/milyonus/memory/store.py:463; git grep -n -F 'turn_id=' -- src returns the pass-through at src/milyonus/memory/pipeline.py:78 and the row reader at src/milyonus/memory/store.py:618.
  • superseded has no writer. git grep -n -E "superseded_by *=|state='superseded'|\"superseded\"" -- src returns the literal in src/milyonus/memory/model.py:29 and the row reader at src/milyonus/memory/store.py:627.
  • No validity time. git grep -n -i -E 'valid_from|valid_to|valid_at|valid_until' -- . returns ROADMAP-30D.md:60 only.
  • Only the verifier writes negative memory. git grep -n 'add_negative(' -- src returns the definition and src/milyonus/memory/pipeline.py:122.
  • Consolidation is not scheduled. git grep -n -E 'consolidate\(' -- src returns its definition and the CLI command at src/milyonus/cli/memory_cmd.py:303.
  • Per-tenant homes have no caller. git grep -n 'open_tenant(' -- src returns the definition at src/milyonus/tenancy.py:50 only.
  • No paper. CITATION.cff is absent; git grep -n -i -E 'arxiv|doi\.org|bibtex' -- . returns nothing, and the same command with -E 'github\.com' matches the README's CI badge line.

History

2026-12-03 — 6907e849…. First reading, from the 2026-12-03 triage shortlist, at the head of main. Screened: one auto-run surface (a committed .githooks/pre-push, inert unless core.hooksPath points there), two build-time execution points (Makefile, src/milyonus/cli/setup.py), and three dependency surfaces inside the cooldown (hf-space/requirements.txt, pyproject.toml, uv.lock), a count the depth-1 clone inflates; no unpinned surface, and uv.lock present. Nothing was installed, built or run, and none of the 307 test functions was run. Five marks (section 9).