agent-bios 0.18.0 → 0.19.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. package/DEPENDENCIES.md +236 -80
  2. package/INSTALL.md +112 -0
  3. package/README.md +187 -524
  4. package/claude/CLAUDE.md +1 -1
  5. package/claude/guides/cli-multi-model-workflow.md +1 -1
  6. package/claude/guides/learning-flow.md +23 -12
  7. package/claude/guides/session-distill-workflow.md +22 -12
  8. package/claude/skills/understand/SKILL.md +52 -22
  9. package/codex/AGENTS.md +1 -1
  10. package/codex/guides/cli-multi-model-workflow.md +1 -1
  11. package/codex/guides/learning-flow.md +23 -12
  12. package/codex/guides/session-distill-workflow.md +22 -12
  13. package/compose/app_bridge/SKILL.md +75 -0
  14. package/compose/app_bridge/agents/openai.yaml +2 -0
  15. package/compose/app_bridge/scripts/bridge.py +76 -0
  16. package/compose/bootstrap/SKILL.md +12 -1
  17. package/compose/corpus.py +31 -9
  18. package/compose/corpus_app.py +456 -0
  19. package/compose/corpus_import.py +529 -0
  20. package/compose/corpus_install.py +202 -18
  21. package/compose/corpus_session.py +27 -0
  22. package/compose/corpus_setup.py +676 -0
  23. package/compose/corpus_setup_cli.py +585 -0
  24. package/compose/corpus_setup_i18n.py +324 -0
  25. package/compose/corpus_setup_ui.py +647 -0
  26. package/compose/corpus_store.py +213 -32
  27. package/compose/corpus_transaction.py +43 -10
  28. package/compose/corpus_ui_runtime.py +278 -0
  29. package/compose/corpus_understand.py +173 -22
  30. package/compose/setup/START.md +158 -0
  31. package/compose/ui_runtime/linkify_it_py-2.2.0-py3-none-any.whl +0 -0
  32. package/compose/ui_runtime/manifest.json +238 -0
  33. package/compose/ui_runtime/markdown_it_py-4.2.0-py3-none-any.whl +0 -0
  34. package/compose/ui_runtime/mdit_py_plugins-0.6.1-py3-none-any.whl +0 -0
  35. package/compose/ui_runtime/mdurl-0.1.2-py3-none-any.whl +0 -0
  36. package/compose/ui_runtime/platformdirs-4.11.8-py3-none-any.whl +0 -0
  37. package/compose/ui_runtime/pygments-2.21.0-py3-none-any.whl +0 -0
  38. package/compose/ui_runtime/rich-15.0.0-py3-none-any.whl +0 -0
  39. package/compose/ui_runtime/textual-8.2.8-py3-none-any.whl +0 -0
  40. package/compose/ui_runtime/typing_extensions-4.16.0-py3-none-any.whl +0 -0
  41. package/docs/advanced-launch.md +131 -0
  42. package/docs/assets/corpus-studio.svg +227 -0
  43. package/docs/corpus.md +117 -0
  44. package/docs/recovery.md +201 -0
  45. package/docs/session-model.md +120 -0
  46. package/docs/setup.md +206 -0
  47. package/docs/understand.md +88 -0
  48. package/install.sh +75 -46
  49. package/launch/agent-launch.py +99 -52
  50. package/launch/provision-venv.sh +44 -13
  51. package/learn/collect-learning.py +14 -5
  52. package/learn/learning.schema.json +2 -2
  53. package/package.json +14 -2
  54. package/provenance.json +1 -1
  55. package/wrappers/claude-run.sh +10 -13
@@ -0,0 +1,201 @@
1
+ # Installation, migration, and recovery
2
+
3
+ [← Overview](../README.md) · [Setup](setup.md) · [Corpus](corpus.md) · [Sessions](session-model.md) · [Recovery](recovery.md) · [Launch](advanced-launch.md) · [Understand!](understand.md)
4
+
5
+ Start with `agent-bios status`. Commands use the installed `agent-bios@0.19.1` CLI;
6
+ from a source checkout use `bash install.sh <command>`. For first installation and app
7
+ setup recovery, see [Setup](setup.md). Commands below are **operation references, not a sequence to paste and run**. Preview the specific action you need; do not delete an ownership conflict just to make installation succeed.
8
+
9
+ ## Command reference
10
+
11
+ The npm package and command are both named `agent-bios`. Installation is always
12
+ explicit—never a package-manager postinstall side effect—and the default path stores
13
+ an immutable release and baseline under agent-bios-owned state. It installs the
14
+ `agent-launch` entrypoint and its own profile/catalog files, but does not change native
15
+ Claude/Codex globals, settings or hooks. Optional app registration adds only its
16
+ owned discovery link, and optional shell connection changes only its owned startup
17
+ wiring. Neither activates corpus in a task.
18
+
19
+ | Command | Purpose |
20
+ | --- | --- |
21
+ | `npm install -g agent-bios@0.19.1` | install the CLI package; private setup is a separate explicit command |
22
+ | `agent-bios install` | open the guided installation UI |
23
+ | `agent-bios install --non-interactive --corpus none` | store runtime with no active corpus |
24
+ | `agent-bios onboard --non-interactive --domains builder-base,multi-agent-orchestration` | store the named domains with compatibility core/infra selection |
25
+ | `agent-bios setup status --review-id ID` / `resume --review-id ID` | inspect the setup receipt / prepare a safe continuation without executing it |
26
+ | `agent-bios verify` | verify stored bytes/catalog/baseline; not host activation |
27
+ | `agent-bios status` | show the private release, baseline, conflicts, and evidence state |
28
+ | `agent-bios corpus` | rich Corpus Studio in a TTY; list in a non-TTY |
29
+ | `agent-launch claude` | open the launch TUI for Claude |
30
+ | `agent-launch codex` | open the launch TUI for Codex |
31
+ | `agent-bios shell restore` | opt in: bare claude/codex opens the TUI |
32
+ | `agent-bios shell remove` | remove only that optional shell connection |
33
+ | `agent-bios reset` | preview reset; keep sources, snapshots, and pins |
34
+ | `agent-bios reset --apply --yes --expected-revision REV` | use the revision returned by preview |
35
+ | `agent-bios migrate` | preview legacy global cleanup; --apply --yes performs it |
36
+ | `agent-bios update` | git pull + reinstall (clone), or print the npm update line |
37
+ | `agent-bios uninstall` | remove owned runtime entries; retain user corpus and pinned sessions |
38
+
39
+ `agent-launch` examples assume `~/.local/bin` is on `PATH`; otherwise use `"$HOME/.local/bin/agent-launch"`. From a checkout, deploy with `bash install.sh install` at its root, not the globally installed CLI. A blocked npm postinstall message does not deploy the corpus; the explicit `install` command remains necessary.
40
+
41
+ ## Ownership and legacy migration
42
+
43
+ `install`, `onboard`, `reset`, `migrate`, and `uninstall` expose dry-run or preview
44
+ paths appropriate to their mutations. A pre-existing owned launcher/profile path whose
45
+ bytes no longer match the recorded copy is reported as an owned-path conflict rather than
46
+ overwritten. `migrate` is the separate recovery-backed operation for a legacy global
47
+ installation: preview is the default, applying requires `--apply --yes`, ambiguous
48
+ ownership refuses the apply, and later private operations do not fall through to a
49
+ global writer. Setting `AGENT_BIOS_LEGACY_INSTALL=1` selects the old deployer only for
50
+ compatibility and migration regression work; it is not the user default.
51
+
52
+ The legacy compatibility deployer preserves guide paths named only by a previous
53
+ manifest when the current source no longer establishes their ownership. It names
54
+ these remnants for manual inspection and leaves them out of the new ownership
55
+ manifest, so later uninstall does not claim them. Current source-owned members
56
+ retain normal backup and selection cleanup; private snapshot installation uses its
57
+ own authoritative inventory.
58
+
59
+ After updating a legacy global installation, run `agent-bios migrate` before the
60
+ first private `install`. Its preview identifies exact managed regions, legacy
61
+ manifest paths and learning sources. `agent-bios migrate --apply --yes` backs up
62
+ the originals, transfers and verifies learning records, retires the legacy paths,
63
+ then installs the private release. A central-only Codex file and the unmodified
64
+ empty Claude learning seed do not require a learning JSONL file; actual learning
65
+ content without its source still requires attention.
66
+
67
+ An interrupted migration is visible in `status` and blocks configuration readers
68
+ and unrelated writes. Re-run `agent-bios migrate --apply --yes` to resume its
69
+ pinned release and recorded path versions. A completed private installation is
70
+ not repeated, and later cleanup cannot delete its replacement launcher/profile.
71
+ Intervening edits are preserved and reported instead of overwritten. Older
72
+ incomplete journals without replay evidence require reconciliation from their
73
+ backups rather than a guessed replay. Existing private-session replay retains the
74
+ previous confirmed release until migration completes.
75
+
76
+ Before applying or resuming, stop the old global collectors that can still append a native
77
+ learning JSONL or rewrite its native prose/entry file. The migration checks the
78
+ recorded native state immediately before commit, but no filesystem check can make
79
+ a noncooperating writer atomic after that final observation. If it reports a
80
+ changed native target, preserve only the affected paths and restore only those
81
+ paths to the journal's recorded `after` state before resuming the old migration.
82
+ Do not replace a whole native directory or edit the journal.
83
+
84
+ For a validated late-input recovery, set `JOURNAL` to the one `NEEDS_RECOVERY`
85
+ migration journal and pass only the specific changed JSONL, prose, or entry paths
86
+ that its error named. This makes a new durable copy under that journal's existing
87
+ `backup_root`, verifies the copy, and then restores a changed target from its
88
+ recorded `after` bytes/existence/mode or an input-only path to its recorded
89
+ unchanged existence. It rejects a path absent from the journal, symlinks, and
90
+ non-regular files before writing any backup. New private journals retain exact
91
+ bytes for input-only native files, so the command can restore an originally
92
+ present input while preserving its current mode (or using `0600` if it is
93
+ absent). Historic digest-only journals still need an external byte-identical
94
+ backup; the command refuses to invent their missing bytes.
95
+
96
+ ```sh
97
+ JOURNAL="${AGENT_BIOS_STATE_DIR:-$HOME/.local/share/agent-bios}/runtime/migrations/<migration-id>/journal.json"
98
+ python3 - "$JOURNAL" \
99
+ "$HOME/.codex/personal/learnings.jsonl" <<'PY'
100
+ import base64, hashlib, json, os, sys, tempfile
101
+ from pathlib import Path
102
+
103
+ journal = Path(sys.argv[1])
104
+ data = json.loads(journal.read_text(encoding="utf-8"))
105
+ backup_root = Path(data.get("backup_root", ""))
106
+ if data.get("kind") != "migrate" or data.get("state") != "NEEDS_RECOVERY" or backup_root != journal.parent / "backup":
107
+ raise SystemExit("expected one validated NEEDS_RECOVERY migration journal")
108
+ targets = {Path(entry["path"]): entry for entry in data["paths"]}
109
+ inputs = {Path(path): version for path, version in data["inputs"].items()}
110
+ selected = [Path(value).expanduser() for value in sys.argv[2:]]
111
+ unknown = [str(path) for path in selected if path not in targets and path not in inputs]
112
+ if not selected or unknown:
113
+ raise SystemExit("name one or more exact journal paths; unknown: " + ", ".join(unknown))
114
+
115
+ planned = []
116
+ for path in selected:
117
+ entry = targets.get(path)
118
+ version = entry["after"] if entry is not None else inputs[path]
119
+ if path.is_symlink() or (path.exists() and not path.is_file()):
120
+ raise SystemExit(f"refusing unsafe native path: {path}")
121
+ root = next((parent for parent in (path.parent, *path.parents)
122
+ if parent.name in {".claude", ".codex"}), None)
123
+ if root is None or root.is_symlink():
124
+ raise SystemExit(f"recovery supports an exact Claude/Codex native path, not: {path}")
125
+ current = root
126
+ for part in path.relative_to(root).parts:
127
+ current /= part
128
+ if current.is_symlink():
129
+ raise SystemExit(f"refusing symlink ancestor: {current}")
130
+ planned.append((path, entry, version))
131
+
132
+ if backup_root.is_symlink() or (backup_root.exists() and not backup_root.is_dir()):
133
+ raise SystemExit(f"refusing unsafe recovery root: {backup_root}")
134
+ backup_root.mkdir(parents=True, exist_ok=True, mode=0o700)
135
+ recovery = Path(tempfile.mkdtemp(prefix="recovery-before-resume-", dir=backup_root)) / "files"
136
+ for path, entry, version in planned:
137
+ if path.exists():
138
+ saved = recovery / str(path).lstrip("/")
139
+ saved.parent.mkdir(parents=True, exist_ok=True)
140
+ before = path.read_bytes()
141
+ saved.write_bytes(before)
142
+ saved.chmod(path.stat().st_mode & 0o777)
143
+ if saved.read_bytes() != before:
144
+ raise SystemExit(f"backup did not verify: {saved}")
145
+ if not version["exists"]:
146
+ path.unlink(missing_ok=True)
147
+ continue
148
+ encoded = version.get("bytes_b64")
149
+ if not isinstance(encoded, str):
150
+ raise SystemExit(f"journal records only a digest for existing input; restore it from an exact external backup: {path}")
151
+ body = base64.b64decode(encoded.encode("ascii"), validate=True)
152
+ if hashlib.sha256(body).hexdigest() != version["sha256"]:
153
+ raise SystemExit(f"journal after bytes are invalid: {path}")
154
+ descriptor, temporary = tempfile.mkstemp(prefix=f".{path.name}.", dir=path.parent)
155
+ try:
156
+ with os.fdopen(descriptor, "wb") as output:
157
+ output.write(body)
158
+ output.flush()
159
+ os.fsync(output.fileno())
160
+ mode = entry["mode"] if entry is not None else (path.stat().st_mode & 0o777 if path.exists() else 0o600)
161
+ os.chmod(temporary, mode)
162
+ os.replace(temporary, path)
163
+ finally:
164
+ Path(temporary).unlink(missing_ok=True)
165
+ print(recovery)
166
+ PY
167
+ ```
168
+
169
+ Resume the old journal with `agent-bios migrate --apply --yes`. After it commits,
170
+ restore only the preserved late record (`B`) from the printed recovery directory
171
+ to its original native path, then run a fresh `agent-bios migrate` preview and
172
+ `agent-bios migrate --apply --yes`. The new migration imports `B` through the
173
+ normal learning-id deduplication path. Leave every other recovery copy in place
174
+ as evidence; it is not an instruction to restore all saved native files.
175
+
176
+ ```sh
177
+ RECOVERY_BACKUP='<the directory printed above>'
178
+ B="$HOME/.codex/personal/learnings.jsonl" # the one path you deliberately preserved
179
+ cp "$RECOVERY_BACKUP/${B#/}" "$B"
180
+ agent-bios migrate
181
+ agent-bios migrate --apply --yes
182
+ ```
183
+
184
+ ## Installation and rollback
185
+
186
+ Installation and rollback validate the target baseline and personal field/member
187
+ changes together. Conflicts preserve the current selection rather than dropping
188
+ items from a successful snapshot. Installation publishes a complete corpus/config
189
+ association under the same lock used by readers. Pending publication is disclosed
190
+ by status and prevents a new configured launch from reading mixed state; bare and
191
+ pinned replay can use the last confirmed immutable release.
192
+
193
+ ## Full reset
194
+
195
+ Full reset returns an `expected_revision` in its preview. Pass that value with
196
+ `--apply --yes`; a changed preview is refused. Retry the accepted revision to finish
197
+ an interrupted reset, or review and accept a fresh revision to replace a stale
198
+ reset intent. Later user changes and replacement credentials are not overwritten
199
+ by the old intent. Nonsecret settings are archived; token bytes never are.
200
+
201
+ Reset also clears individual on/off overrides and the active trophy display generation. It is not a deletion of uploaded learning records. See [corpus controls](corpus.md) and [learning discoveries](understand.md).
@@ -0,0 +1,120 @@
1
+ # Sessions, storage, and verification
2
+
3
+ [← Overview](../README.md) · [Setup](setup.md) · [Corpus](corpus.md) · [Sessions](session-model.md) · [Recovery](recovery.md) · [Launch](advanced-launch.md) · [Understand!](understand.md)
4
+
5
+ **Library → selection and edits → immutable snapshot → configured session**
6
+
7
+ ## Corpus ownership
8
+
9
+ Single source of truth for the instructions and scoped guides supplied to activated
10
+ Claude Code or Codex CLI sessions, or explicitly chosen Codex app tasks. Edit once;
11
+ the private corpus compiler projects the selected content through the chosen delivery route.
12
+
13
+ A deployable instruction corpus for coding agents, plus the CLI that
14
+ installs, verifies, and evolves it. The npm package ships the corpus; `install.sh` is both the
15
+ `agent-bios` CLI entry and the deployer.
16
+
17
+ ## Authored layers
18
+
19
+ Two authored layers:
20
+
21
+ - **Always-in-an-activated-session instructions** — `claude/CLAUDE.md` is the English canonical and `codex/AGENTS.md` its generated host projection. They hold compact invariants, decision principles, and guide pointers. A clean private install does not copy either file into a host's global discovery path; `compose/corpus_catalog.py` inventories their registered items and compiles the selected rules into an immutable session snapshot.
22
+ - **Scoped guides** — `claude/guides/`, with generated Codex mirrors. The snapshot compiler copies selected guides to private generation-qualified paths and emits their router. Procedures, tables, numbers, and environment-specific content live here.
23
+
24
+ ## Activation and Vanilla
25
+
26
+ The private install does not replace the `codex` or `claude` shell commands by default. Run
27
+ `agent-launch claude` or `agent-launch codex` explicitly to open the preflight, or pass `--preset NAME HOST` for a
28
+ configured non-interactive launch. Software Engineer / Vanilla structurally projects
29
+ no agent-bios snapshot, launch contract, tier binding, or permission flag. After a
30
+ fresh private install—or after an explicit legacy migration—the native CLI therefore
31
+ receives no automatic agent-bios content; the user's own native global and project
32
+ instructions still follow the host's normal loading rules. `--resume-session ID`
33
+ loads the recorded host/session pin rather than resolving current defaults.
34
+
35
+ Per-item on/off overrides take precedence over default-mode launch-domain selection.
36
+ No-corpus mode emits no corpus. Explicit selected mode keeps inclusion within its
37
+ targets; disabled items stay excluded and unrelated enabled overrides do not leak in.
38
+ Imported items also respect their host/project scope. See [corpus selection](corpus.md#manage-the-library). Existing host globals are loaded by default; [selective exclusion](advanced-launch.md#global-instruction-files) is a separate host-specific option.
39
+
40
+ ## Codex app tasks
41
+
42
+ App tasks have an explicit [use/off workflow](setup.md#use-corpus-in-a-codex-app-task).
43
+ Use returns a selected snapshot through the tool/context path and records a
44
+ `returned-as-context` receipt separately from native CLI pins. Stored registration
45
+ and returned text do not prove native app discovery or model reading. Off stops
46
+ further managed use, but cannot retract earlier context; a new task is needed for
47
+ clean exclusion. Management and instruction capture do not activate task context.
48
+
49
+ ## Storage layout
50
+
51
+ From a clone, `bash install.sh install` is the same default path. The release lives
52
+ under `~/.local/share/agent-bios/runtime/releases/`; baseline tuples and transaction
53
+ journals live under that runtime root, immutable snapshots and pins under
54
+ `~/.local/share/agent-bios/sessions/`, and user packages, overlays, tombstones,
55
+ learnings, history, and trash under `~/.config/agent-bios/corpus/`. The corresponding
56
+ `AGENT_BIOS_STATE_DIR` and `AGENT_BIOS_CORPUS_DIR` environment variables relocate
57
+ those private roots; `AGENT_LAUNCH_VENV` relocates the managed dependency environment.
58
+ The UI entrypoints use their verified process-temporary bundle without
59
+ requiring a preinstalled Textual runtime.
60
+ The owned `agent-launch` entrypoint exports `AGENT_BIOS_PRIVATE_CORPUS=1` and the
61
+ immutable `AGENT_BIOS_PACKAGE_ROOT`; the launcher also recognizes the private install
62
+ record when the explicit marker is absent. These select the private runtime and do not
63
+ claim that any host session has loaded a snapshot.
64
+
65
+ ## Verification and limits
66
+
67
+ `agent-bios verify` checks the recorded immutable release file-by-file, reloads a
68
+ non-empty catalog from that release, matches the store's last successful baseline to
69
+ the install record, and verifies the owned launcher/profile/status projections. Its
70
+ result says `activation: unverified`: neither stored bytes nor a dry-run argv proves a
71
+ host loaded the snapshot.
72
+
73
+ Corpus selection seeds future activated sessions, not plain CLI/Vanilla. A one-off
74
+ `--corpus-domains` selection applies only to that launch. The store composes an
75
+ immutable `ContentRef`; Codex startup preserves the effective native developer
76
+ instructions, injects the private corpus and dynamic launch contract, creates and
77
+ reads back a durable host thread, then records its pin. Claude uses the per-call
78
+ append and requested session id and records a pin only after observing that id in the
79
+ native session log. Real-host probes cover Codex and Claude first-turn delivery,
80
+ including corpus propagation to a launcher-generated Claude workhorse. Claude
81
+ resume restores the pin's exact environment provenance rather than changing an unset
82
+ config-home variable into an explicit default. Post-fix authenticated resume remains
83
+ unverified. Snapshot pin integrity alone does
84
+ not establish that a resumed model request succeeded.
85
+
86
+ The native Claude plugin bootstrap has advertised selected plugin roots and
87
+ qualified corpus agents. An edited corpus `SessionStart` hook ran automatically
88
+ through its generated plugin. Codex 0.153.4 discovery retains user, project and session
89
+ hooks alongside the selected corpus. A real-host test with a local transport verifies
90
+ that a generated `SessionStart` hook runs and injects context after its exact definition
91
+ is trusted; the untrusted control does neither. This test uses no external model.
92
+ Authenticated corpus-agent execution and native skill-menu registration remain
93
+ unverified; they are separate from hook delivery and launcher-tier child evidence.
94
+
95
+ Pins preserve environment provenance rather than reconstructing it: the host's
96
+ config-home variable, and `HOME` when needed for default lookup, retain their
97
+ recorded unset, set, or explicitly empty state. A relative native home is resolved
98
+ from the recorded canonical cwd. Pins lacking that context fail explicitly at resume;
99
+ it is never inferred from the caller's environment.
100
+
101
+ Named native Codex profiles (`--profile` / `-p`) are not supported for private
102
+ activation by the verified 0.153.4 adapter: that host exposes profiles on runtime
103
+ commands but not its effective-config app-server surface. The launcher refuses
104
+ this combination before creating a session rather than substituting base settings.
105
+ Plain CLI/Vanilla profile use is unchanged. Activated private Codex sessions also
106
+ refuse native `--cd`/`-C` cwd overrides before delivery; change to the target project
107
+ first so snapshot scope and native execution agree. Ordinary CLI/Vanilla forwarding
108
+ keeps its native behavior.
109
+
110
+ Snapshots outside no-corpus mode retain the immutable private management bootstrap
111
+ and put its exact path in the injected startup text, so `$agent-bios` has private
112
+ procedure access even without native skill discovery. Selected requested procedures are exposed the same
113
+ way. This is not a claim that either host registered them in its native skill menu;
114
+ native skill registration remains unverified.
115
+
116
+ ## Scope
117
+
118
+ The repository and npm package contain corpus sources and private runtime machinery,
119
+ not a user's authoring state, learning events, snapshots, pins, activation journals,
120
+ credentials, native settings, or generated temporary files.
package/docs/setup.md ADDED
@@ -0,0 +1,206 @@
1
+ # Setup, app connection, and personal instructions
2
+
3
+ [← Overview](../README.md) · [Corpus](corpus.md) · [Sessions](session-model.md) · [Recovery](recovery.md)
4
+
5
+ Install `agent-bios@0.19.1` through the [README quick start](../README.md#quick-start)
6
+ to use the guided installer, conversation setup, app bridge and instruction import.
7
+ Commands below use the installed `agent-bios` CLI. From a source checkout, run
8
+ `bash install.sh <command>` at its root instead.
9
+
10
+ ## Choose where to start
11
+
12
+ | Route | Requirements | Interface |
13
+ | --- | --- | --- |
14
+ | Codex app | A local task with command/file access on the intended machine, Bash, Python 3.11+ | Questions and effect review in the conversation; no extra Codex CLI or model login |
15
+ | Terminal | macOS or Linux, Bash, Python 3.11+, an input/output terminal; Node.js 18+/npm for package installation | Included Textual wizard |
16
+ | Automation | Bash, Python 3.11+, explicit machine commands | JSON inspection, review and results |
17
+
18
+ Host CLIs and their authentication are needed when you choose to launch them.
19
+ Node/npm are needed to obtain the npm package and for any selected capability that
20
+ uses them. Source acquisition through the app does not require npm. The app and
21
+ storage routes do not require every host CLI. Full versions,
22
+ purposes and provisioning boundaries are in [Dependencies](../DEPENDENCIES.md).
23
+
24
+ For first installation in the app, use the one-line request in the README. The
25
+ agent follows [INSTALL.md](../INSTALL.md), asks for English, 한국어 or 日本語, and
26
+ obtains one fixed source revision. It handles the local paths. Downloads and
27
+ retained acquisition artifacts are disclosed before setup Apply. If that revision
28
+ lacks the required setup files, the agent reports this instead of invoking an
29
+ older installation mode.
30
+
31
+ ## Guided terminal installation
32
+
33
+ Install the exact package version, then start setup:
34
+
35
+ ```bash
36
+ npm install -g agent-bios@0.19.1
37
+ agent-bios install
38
+ ```
39
+
40
+ For the source alternative, obtain the repository through its Code menu and run
41
+ `bash install.sh install` at its root.
42
+
43
+ `install` and `onboard` open the wizard by default. After the language choice,
44
+ four stages collect the choices:
45
+
46
+ 1. **Corpus:** no active corpus, all available corpus, selected packages/domains,
47
+ or saved policy on an existing installation. **Connect to the Codex app** is
48
+ an independent option for adding `$agent-bios` to app conversations.
49
+ 2. **Personal instructions:** optionally add project folders and select detected
50
+ global/project instruction files for capture. This is independent of corpus use.
51
+ 3. **Dependencies:** inspect the full inventory. Ready dependencies are checked
52
+ and cannot be toggled; only missing dependencies with a supported recipe can
53
+ be selected for installation. Leaving those unselected installs none.
54
+ 4. **Review:** inspect the effects and, when useful, expand exact commands and
55
+ paths before Apply.
56
+
57
+ The fresh wizard starts with no active corpus. Reinstalling keeps saved choices
58
+ unless you change them. No active corpus retains the library privately but delivers
59
+ no corpus instruction text or management bootstrap. Explicit selected mode includes
60
+ only its targets within applicable host/project scope; it does not add unrelated
61
+ enabled items or implicit core content.
62
+
63
+ Personal instructions and host learning records already on this device appear in
64
+ a separate checked, read-only list with stored item counts. These entries describe
65
+ retained content across project scopes, not the active corpus policy or new installation
66
+ choices. No active corpus preserves them. Use Corpus Studio for personal content and
67
+ selection changes; merely displaying stored content does not activate it. The list
68
+ can also show retained content after private runtime removal.
69
+
70
+ The installer, launcher and Corpus Studio use a verified UI bundle without downloading or installing
71
+ Textual. Its extraction is temporary and removed on exit. Missing or damaged
72
+ bundled UI fails explicitly. Language changes presentation, not corpus text,
73
+ identifiers or host settings.
74
+
75
+ Back preserves your choices. Cancelling before Apply performs no planned setup
76
+ effects. During Apply, cancellation requests a stop at an execution boundary;
77
+ completed package installations remain and are reported. A dependency, runtime,
78
+ app-registration or capture failure can leave completed effects. Review the result
79
+ before retrying rather than assuming everything rolled back.
80
+
81
+ Selection flags seed the wizard; they do not skip it:
82
+
83
+ ```bash
84
+ agent-bios install --corpus none
85
+ agent-bios install --corpus selected --select '@agent-bios/core/builder-base'
86
+ agent-bios install --dry-run
87
+ ```
88
+
89
+ `--dry-run` permits review but no Apply. A non-TTY caller must explicitly use a
90
+ machine route. Direct storage-only examples are:
91
+
92
+ ```bash
93
+ agent-bios install --non-interactive --corpus none
94
+ agent-bios install --non-interactive --corpus all
95
+ agent-bios install --non-interactive --corpus selected --select '@agent-bios/core/builder-base'
96
+ ```
97
+
98
+ Those direct commands do not collect dependency, app or import choices. Use the
99
+ shared conversation protocol below for a complete machine setup plan. The legacy
100
+ `--domains` flag requires `--non-interactive` and retains its implicit core/infra
101
+ meaning; `--domains none` is different from `--corpus none`.
102
+
103
+ ## Setup through conversation or automation
104
+
105
+ The app asks questions and displays the review using its available controls. It
106
+ does not require a custom settings panel or a terminal UI. The same controller
107
+ validates and executes terminal and conversation choices.
108
+
109
+ ```bash
110
+ agent-bios setup start
111
+ agent-bios setup inspect --language ko
112
+ agent-bios setup discover --project-root /absolute/project
113
+ agent-bios setup plan --language ko --input setup-choices.json > reviewed-setup.json
114
+ agent-bios setup apply --input reviewed-setup.json --review-id REVIEW_ID --yes
115
+ agent-bios setup status --review-id REVIEW_ID
116
+ agent-bios setup resume --review-id REVIEW_ID
117
+ ```
118
+
119
+ `start` returns the supported languages, execution target and guide without
120
+ dependency probes or private setup writes. Choose the language before `inspect`.
121
+ The agent produces the six choice fields from your answers and saves the entire
122
+ engine-issued review. It shows the selected commands, destinations, corpus policy,
123
+ app change and capture sources before applying authorized effects. The engine
124
+ rejects a changed source, environment, plan or state; `--yes` alone is not evidence
125
+ that the effects were reviewed.
126
+
127
+ Dependency readiness and installation intent are separate: an already available
128
+ dependency never belongs in the requested `dependencies` list or new install actions.
129
+ The separate `retained_corpus` inventory contains `{target, label, item_count}` rows,
130
+ with localized labels in `display.retained_corpus`, and no instruction bodies. Source
131
+ package choices and the selected activation policy remain independent of that storage
132
+ view; retained entries are not added to `targets` by being displayed.
133
+
134
+ Status and resume are read-only. An old completed receipt describes that attempt;
135
+ current runtime/helper readiness is reported separately. A running operation can
136
+ defer readiness checks and return null fields while still showing recorded progress.
137
+ Resume returns a fresh nested review only when remaining effects can be determined;
138
+ it does not replay uncertain operations. The agent follows the full procedure in
139
+ [START.md](../compose/setup/START.md), including exact review preservation and verified
140
+ entrypoint handoff. Source and reviewed artifacts remain available for recovery.
141
+
142
+ ## Use corpus in a Codex app task
143
+
144
+ Choose **Connect to the Codex app** during setup, or explicitly run:
145
+
146
+ ```bash
147
+ agent-bios app register --dry-run
148
+ agent-bios app register
149
+ agent-bios app status --json
150
+ ```
151
+
152
+ Registration creates the owned `~/.agents/skills/agent-bios` discovery link to a
153
+ private immutable helper. Implicit invocation is disabled. An unrelated or edited
154
+ entry is preserved. Registration on disk does not prove the app discovered it;
155
+ setup can return a usable helper path to continue before discovery refreshes.
156
+
157
+ Once discovered, use `$agent-bios` in the chosen task. Ask it to manage the library,
158
+ change setup, show task status, or explicitly use selected corpus in this task.
159
+ A setup or management request does not activate content. Each task starts with
160
+ managed delivery off and requires its own explicit use.
161
+
162
+ Use previews a `ContentRef` and then returns the exact snapshot's
163
+ `instruction_text` through the task's tool/context path. The receipt says
164
+ `returned-as-context`; it proves neither native startup injection nor model reading.
165
+ Session operations require the real task ID, normally `CODEX_THREAD_ID`. Setup and
166
+ management do not require that ID. App use enables no hooks, agents or permissions.
167
+
168
+ Ask `$agent-bios` to turn corpus delivery off to stop consulting it in subsequent
169
+ work. Text already returned cannot be erased; a fresh task is needed for clean
170
+ exclusion. A resumed or forked conversation can carry earlier content independently
171
+ of the new task's receipt. Native global/project instructions still follow host rules.
172
+
173
+ `agent-bios app unregister` removes only the owned discovery link. It does not erase
174
+ prior task context or personal corpus data. Corpus Studio can also run in the app's
175
+ integrated terminal; editing it changes future snapshots, not current task context.
176
+
177
+ ## Import existing instructions
178
+
179
+ Setup can capture selected native global/project files for later model review.
180
+ You can also use the explicit import workflow:
181
+
182
+ ```bash
183
+ agent-bios import discover --project /absolute/project --json
184
+ agent-bios import capture --project /absolute/project --path /absolute/project/AGENTS.md --json
185
+ agent-bios import prompt CAPTURE_ID
186
+ agent-bios import plan --input reviewed-import.json --json
187
+ agent-bios import apply PLAN_ID --expected-revision REV --json
188
+ ```
189
+
190
+ Discovery checks known global locations and fixed filenames in chosen project
191
+ roots. It does not crawl the home directory or follow instruction references.
192
+ Capture preserves originals and stores redacted evidence with source digests
193
+ privately. It is pending review, not an automatically optimized personal corpus.
194
+
195
+ In an app task, ask `$agent-bios` to review the returned capture ID. The agent
196
+ proposes content, `always`/`relevant`/`requested` placement, rationale, and source-line
197
+ coverage or exclusions. The runtime checks the evidence and structure, and Apply
198
+ requires the reviewed revision. Changed originals or conflicting edits require
199
+ fresh review. Project-scoped imports remain limited to their recorded root and
200
+ applicable hosts, even when all corpus or an enable override is selected.
201
+
202
+ Native hosts may still read the untouched originals. Importing a procedure as
203
+ requested content does not suppress the same rule in a native file, and changing
204
+ placement is not a guarantee of optimal model behavior. Review duplication and
205
+ tradeoffs as part of the proposal. Installation, capture, import and task activation
206
+ have separate outcomes; the result tells you which actually completed.
@@ -0,0 +1,88 @@
1
+ # Understand why the corpus works this way
2
+
3
+ [← Overview](../README.md) · [Setup](setup.md) · [Corpus](corpus.md) · [Sessions](session-model.md) · [Recovery](recovery.md) · [Launch](advanced-launch.md) · [Understand!](understand.md)
4
+
5
+ Understand! is learning for the person using the corpus, not model training. It explores reasons and limits through a conversation rather than asking you to memorize files.
6
+
7
+ ## Start a learning session
8
+
9
+ Choose **Understand!** in the root TUI, or run:
10
+
11
+ ```bash
12
+ agent-bios understand list
13
+ agent-bios understand show core-purpose
14
+ agent-launch --understand core-purpose claude # or codex
15
+ ```
16
+
17
+ The selection is a coherent bundle, not an individual file: core groups cover goals
18
+ and scope, decision support, adaptation, evidence/safety, and retained learning;
19
+ domain and personal bundles come from the effective corpus. A session freezes its
20
+ selected source references and edited content. The tutor explains the purpose,
21
+ background, mechanisms, tradeoffs, and limits, distinguishing documented rationale
22
+ from inference. The tutor chooses a small finite set of core points and tracks their
23
+ coverage and question counts. It uses fewer questions when understanding is sufficient,
24
+ with at most 10 tutor questions per source bullet including all followups and
25
+ clarifications. Ten is a ceiling, not a target. At the limit it explains remaining
26
+ gaps instead of extending the quiz. Supporting guides supply context, not a list of
27
+ implementation details to examine one by one.
28
+
29
+ Questions are optional when explaining, answering or summarizing. Once the core
30
+ points are covered, the tutor summarizes and ends without a compulsory followup.
31
+ If it asks a useful question, it waits for your answer. Pause and stop requests end
32
+ the questioning immediately. This is the tutoring contract; the runtime does not
33
+ claim to measure understanding or independently count semantic questions.
34
+ `understand!` also works through the shared skill in
35
+ an activated session. Learning excerpts are data, not permission to run their commands.
36
+
37
+ ## Read pinned material in bounded pages
38
+
39
+ Startup contains a small tutoring prompt, not the full source bundle. `show` gives
40
+ bundle metadata, and `start`/`session` return a compact entry with the pinned source
41
+ reference. The full source stays in private session storage. Read it on demand:
42
+
43
+ ```bash
44
+ agent-bios understand read SESSION
45
+ agent-bios understand read SESSION --ref '@agent-bios/core:rule-004'
46
+ agent-bios understand read SESSION --ref REF --member MEMBER --offset NEXT --expected-sha256 DIGEST
47
+ ```
48
+
49
+ Without `--ref`, the reader pages a manifest of items and member names without their
50
+ bodies. With a reference it reads the exact effective body, or the named member.
51
+ Each response includes `text`, `source_ref`, `resource_sha256`, `total_bytes`,
52
+ `next_offset` and `eof`. Follow offsets until the needed resource is complete;
53
+ partial output is never a complete-source claim. Offsets count UTF-8 bytes and stay
54
+ on character boundaries, including for a large guide written on one line.
55
+
56
+ `--limit-bytes` accepts 256–16384 bytes, default 8192. The entire JSON response,
57
+ including escaping and metadata, is capped at 32768 bytes. Transcript inspection
58
+ through `turns SESSION` uses the same page format; later transcript pages require
59
+ the preceding digest and restart if the transcript changed. All prior assistant
60
+ turns must still be reviewed before proposing a discovery.
61
+
62
+ Existing pinned sessions and older full-bundle prompt files are not rewritten.
63
+ Use `session SESSION` for the current compact entry and the reader for their exact
64
+ retained source. This does not erase earlier instructions from an already running
65
+ conversation. A resumed old host still needs the current reader and tutoring skill
66
+ to follow this workflow.
67
+
68
+ ## Personal discoveries
69
+
70
+ A meaningful flaw or alternative first introduced by the user can unlock a persistent
71
+ pixel trophy. Tutor-originated ideas, leading hints, and echoes do not qualify. The
72
+ discovery flow binds the native human session, checks recorded turn provenance and
73
+ ordering, and asks for a later exact save confirmation. Unsupported provenance leaves
74
+ the award pending, without blocking learning. Significance and semantic originality
75
+ remain explicit tutor/user judgments; transcript validation does not prove them or
76
+ authenticate against an owner who can edit local files. Only a successfully saved
77
+ requested-only personal corpus note can unlock the trophy. The CLI prints it, and the
78
+ TUI shows it when there is room. Retries do not duplicate the note; updates and note
79
+ deletion retain the trophy. Full reset archives the active unlock generation and clears
80
+ the display; older discovery records cannot reactivate it. Native global files and
81
+ corpus source rules are not rewritten by learning.
82
+
83
+ The runtime checks a new proposal's complete review-response size before storing
84
+ its candidate. An oversized proposal can be shortened and retried without leaving
85
+ an unreachable candidate; required provenance IDs must remain complete. Award
86
+ responses contain a compact receipt, so the saved note body is not echoed in full.
87
+
88
+ Turning an item off for ordinary activated sessions does not remove it from the learning library. On/off preferences and the inventory read revision are not learning content, so they do not repin otherwise unchanged learning bundles.