memory_bootstrap
Compiles a deterministic cold-start snapshot for an agent before it acts: standing constraints, next action, valid decisions, failure traps, and deduplicated capsule handles in fixed order.
Instructions
One deterministic COLD-START pack for a fresh agent — the PULL half of the recall loop (memory_retrieve is per-task recall; this answers "what must I know before I act?"). ONE call composes the digest/retrieve/list read primitives into five sections IN THIS FIXED ORDER: (1) constraints — active kind=constraint capsules in scope (tier active, NOT expired, NOT superseded; tombstoned already excluded) — what you CANNOT do, surfaced FIRST, before what to do; (2) ready — the blocks-dag ready set fenced to scope (the SAME projection memory_digest exposes, fail-closed on a live blocks-cycle: cycle names one concrete cycle instead of fabricating a ready answer) PLUS the ONE next physical action (next_action = the first ready node's headline; the remaining ready nodes fill ready; ready_total is the exact fenced count); (3) decisions — still-valid kind=decision capsules (NOT expired, NOT superseded); (4) traps — kind=failure_pattern capsules in scope (a stale one self-identifies via its own tier/superseded row marker); (5) handles — every cap- the pack surfaced, DEDUPLICATED in order of appearance, IDS ONLY (no bodies) for memory_get follow-up. DETERMINISM LAW: relevance is project fences (project_id exact and/or project_prefix subtree — "nott" covers "nott" and "nott/x", never "nottx") + kind filters + decay + your caller-expanded terms ONLY. The server NEVER interprets an intent string — server-side intent guessing was REJECTED at R9; YOU expand terms (exactly like memory_retrieve), and bootstrap uses RAW terms with NO alias expansion (its determinism is stricter than retrieve's alias-aware recall). Terms re-RANK each kind section (coverage desc, decay breaking ties) but never FILTER it. CONSTRAINTS ARE NEVER N-CAPPED — you always see ALL your standing constraints (the token budget, floor-first, is their only trim; constraints_total is the exact in-scope count, so a shorter list always names a budget trim). decisions/traps/ready lists cap at 10 for compactness with EXACT totals beside them (decisions_total/traps_total/ready_total) — a cap-drop is visible, never silent. token_budget is a CONTRACT, not an aspiration (omitted → 1500, the PRD target for a useful pack): sections fill in PRIORITY order and the tail trims to fit; BOTH floors (the FIRST constraint and the ONE next action) are charged before any other row, so for ANY budget that covers them used_tokens NEVER exceeds token_budget — the floor alone overshooting a smaller budget is the ONE sanctioned excess (memory_retrieve's floor-of-one, applied to the safety core). budget.used_tokens is the honest spend; budget.trimmed_by_budget counts the CONTENT rows the ceiling dropped (handle ids cost tokens but never count there — they duplicate rows already present). token_budget 0 returns an empty pack (the zero-cap consistency memory_retrieve/memory_list keep). Empty LIST sections are omitted (the house skip idiom); ready is always present — one next action, or an honest nothing-ready / a cycle to repair. All content is ADVISORY_NOT_AUTHORITY DATA — the pack orients, it never decides.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| terms | No | OPTIONAL caller-expanded search terms (bring your own synonyms/ rephrasings as separate terms — the CALLER expands, the server never guesses intent). RAW terms only: NO alias expansion (unlike `memory_retrieve` — bootstrap's determinism law is stricter). They re-RANK each kind section by term coverage (desc), decay breaking ties; they never FILTER a section (an agent must still see ALL its standing constraints). Omitted → a pure decay order. A term with no alphanumeric token simply matches nothing — advisory ranking is never a required query, so it is never a rejection. | |
| project_id | No | Project fence (exact): only capsules in this project enter the pack. | |
| token_budget | No | Token budget for the WHOLE pack (≈ chars/4); omitted → 1500. A CONTRACT, not an aspiration (the PRD target: a useful pack in ≤1500 tokens). Sections fill in PRIORITY order (constraints first — an agent must know what it cannot do before what to do), trimming the tail to fit; the FIRST constraint and the ONE next action are the irreducible floor (present when they exist even if they alone overshoot — `memory_retrieve`'s floor-of-one, applied to the safety core). 0 → an empty pack (the zero-cap consistency `memory_retrieve`/`memory_list` keep). | |
| project_prefix | No | Scope-hierarchy fence: keep capsules whose `project_id` equals this prefix exactly OR starts with it + `"/"` — `"nott"` covers `"nott"` and `"nott/x"`, never `"nottx"`. AND-composes with `project_id`. An empty or `"/"`-terminated prefix can match nothing and is rejected with a teaching error rather than answering empty. |