agent-bios 0.18.0 → 0.19.0
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.
- package/DEPENDENCIES.md +236 -80
- package/INSTALL.md +112 -0
- package/README.md +184 -524
- package/claude/CLAUDE.md +1 -1
- package/claude/guides/cli-multi-model-workflow.md +1 -1
- package/claude/guides/learning-flow.md +23 -12
- package/claude/guides/session-distill-workflow.md +22 -12
- package/codex/AGENTS.md +1 -1
- package/codex/guides/cli-multi-model-workflow.md +1 -1
- package/codex/guides/learning-flow.md +23 -12
- package/codex/guides/session-distill-workflow.md +22 -12
- package/compose/app_bridge/SKILL.md +75 -0
- package/compose/app_bridge/agents/openai.yaml +2 -0
- package/compose/app_bridge/scripts/bridge.py +76 -0
- package/compose/bootstrap/SKILL.md +12 -1
- package/compose/corpus.py +31 -9
- package/compose/corpus_app.py +456 -0
- package/compose/corpus_import.py +529 -0
- package/compose/corpus_install.py +196 -18
- package/compose/corpus_session.py +27 -0
- package/compose/corpus_setup.py +674 -0
- package/compose/corpus_setup_cli.py +582 -0
- package/compose/corpus_setup_i18n.py +318 -0
- package/compose/corpus_setup_ui.py +633 -0
- package/compose/corpus_store.py +167 -29
- package/compose/corpus_transaction.py +43 -10
- package/compose/corpus_ui_runtime.py +278 -0
- package/compose/setup/START.md +147 -0
- package/compose/ui_runtime/linkify_it_py-2.2.0-py3-none-any.whl +0 -0
- package/compose/ui_runtime/manifest.json +238 -0
- package/compose/ui_runtime/markdown_it_py-4.2.0-py3-none-any.whl +0 -0
- package/compose/ui_runtime/mdit_py_plugins-0.6.1-py3-none-any.whl +0 -0
- package/compose/ui_runtime/mdurl-0.1.2-py3-none-any.whl +0 -0
- package/compose/ui_runtime/platformdirs-4.11.8-py3-none-any.whl +0 -0
- package/compose/ui_runtime/pygments-2.21.0-py3-none-any.whl +0 -0
- package/compose/ui_runtime/rich-15.0.0-py3-none-any.whl +0 -0
- package/compose/ui_runtime/textual-8.2.8-py3-none-any.whl +0 -0
- package/compose/ui_runtime/typing_extensions-4.16.0-py3-none-any.whl +0 -0
- package/docs/advanced-launch.md +131 -0
- package/docs/assets/corpus-studio.svg +227 -0
- package/docs/corpus.md +117 -0
- package/docs/recovery.md +201 -0
- package/docs/session-model.md +120 -0
- package/docs/setup.md +190 -0
- package/docs/understand.md +40 -0
- package/install.sh +75 -46
- package/launch/agent-launch.py +91 -47
- package/launch/provision-venv.sh +44 -13
- package/learn/collect-learning.py +14 -5
- package/learn/learning.schema.json +2 -2
- package/package.json +14 -2
- package/provenance.json +1 -1
- package/wrappers/claude-run.sh +10 -13
package/claude/CLAUDE.md
CHANGED
|
@@ -114,4 +114,4 @@
|
|
|
114
114
|
|
|
115
115
|
## Session Learning
|
|
116
116
|
|
|
117
|
-
- `learn!` — session learning: when the user enters `learn
|
|
117
|
+
- `learn!` — session learning: when the user enters `learn!`, capture durable lessons from THIS session for future selected sessions and configured org curation. Read `${CLAUDE_CONFIG_DIR:-$HOME/.claude}/guides/learning-flow.md` and follow its admission bar → type A–G → intended layer → explicit user approval → package-bound submission. The tool owns id/timestamp and private capture; it preserves native globals. A Session distill preset (`distill!`) owns its capture — do not run both flows. Never manufacture Type-G principles user-side (curator-only).
|
|
@@ -233,7 +233,7 @@ Write for the next agent and re-verification, not narrative. Required content:
|
|
|
233
233
|
|
|
234
234
|
## Environment Binding (edit per environment)
|
|
235
235
|
|
|
236
|
-
This is the human-readable projection of concrete models/tools; `launch/agent-launch.toml` is the machine launch authority and parity checks keep them aligned. Re-probe when the binding is older than ~8 weeks or a newer observable model/tool changes the surface.
|
|
236
|
+
This is the human-readable projection of concrete models/tools; `launch/agent-launch.toml` is the machine launch authority and parity checks keep them aligned. Re-probe when the binding is older than ~8 weeks or a newer observable model/tool changes the surface. Edit shipped defaults in the source repository; keep personal launch bindings in user-owned launcher configuration. Private installation stores an immutable release and preserves personal state. A new configured session resolves its bindings; existing session pins retain theirs.
|
|
237
237
|
|
|
238
238
|
Binding (2026-09-08):
|
|
239
239
|
|
|
@@ -9,14 +9,15 @@ use_when:
|
|
|
9
9
|
core_rules:
|
|
10
10
|
- three gates BEFORE asking the user — admission bar, type, consumption layer
|
|
11
11
|
- the user approves every recorded learning; nothing is written without it
|
|
12
|
-
- submit ONLY through
|
|
12
|
+
- submit ONLY through the package-bound learn command below; never hand-write the record
|
|
13
13
|
---
|
|
14
14
|
|
|
15
15
|
# Session learning flow (`learn!`)
|
|
16
16
|
|
|
17
17
|
The **light**, per-user, single-session capture flow: turn a lesson from the
|
|
18
18
|
current session into a **learning** (prose + a JSON record) that (a) applies to
|
|
19
|
-
the user's
|
|
19
|
+
the user's future selected, activated sessions and (b) reaches the org for curation
|
|
20
|
+
when transport is configured. This is the
|
|
20
21
|
counterpart of the **heavy** session-distill pipeline (`distill!`), which mines
|
|
21
22
|
many sessions and is curator/power-user only. Terminology and the full routing
|
|
22
23
|
framework are maintained in the agent-bios repo; the criteria this flow applies
|
|
@@ -75,6 +76,14 @@ Surface each surviving candidate compactly — lesson, type, intended layer,
|
|
|
75
76
|
admission-bar verdict, domain (+ proposed_domain) — and record ONLY what the
|
|
76
77
|
user explicitly approves.
|
|
77
78
|
|
|
79
|
+
In a Codex app task using the explicit corpus bridge, use the `learn` command
|
|
80
|
+
and environment returned in its `runtime` metadata, or its registered helper.
|
|
81
|
+
Shell exports from an earlier app tool call do not persist into later calls.
|
|
82
|
+
|
|
83
|
+
In a launcher-activated session, invoke `learn` through the supplied
|
|
84
|
+
`AGENT_BIOS_PACKAGE_ROOT` as shown below. Outside an activated session, resolve
|
|
85
|
+
the installed `agent-bios` executable and use its `learn` subcommand.
|
|
86
|
+
|
|
78
87
|
Submit each approved learning through the deterministic submit tool. Pass your
|
|
79
88
|
session's `--host` and pipe the **semantic payload only** as one JSON object on
|
|
80
89
|
stdin (set the `supporting_sessions` tool prefix — `claude:` or `codex:` — to
|
|
@@ -83,16 +92,18 @@ match your host):
|
|
|
83
92
|
echo '{"lesson":"…","domain":"builder-base","supporting_sessions":["<tool>:<session-short-id>"],
|
|
84
93
|
"criteria":["recurrent_error"],
|
|
85
94
|
"classification":{"type":"B","layer":"hook","meets_bar":true}}' \
|
|
86
|
-
|
|
|
87
|
-
|
|
88
|
-
The script (capability boundary) owns `learning_id` / `created` / `schema_version
|
|
89
|
-
validates against `learn/learning.schema.json
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
95
|
+
| bash "$AGENT_BIOS_PACKAGE_ROOT/install.sh" learn --host <claude|codex>
|
|
96
|
+
|
|
97
|
+
The script (capability boundary) owns `learning_id` / `created` / `schema_version`
|
|
98
|
+
and validates against `learn/learning.schema.json`. It appends the record to the
|
|
99
|
+
private corpus's `learnings/<host>/events.jsonl`, keeping Claude and Codex captures
|
|
100
|
+
separate. Selected learnings enter future activated-session snapshots through the
|
|
101
|
+
private corpus. Capture preserves the user's global instruction files and the
|
|
102
|
+
running session's snapshot. Upload runs after local storage when transport is configured.
|
|
103
|
+
The private root is `$AGENT_BIOS_CORPUS_DIR`, defaulting to
|
|
104
|
+
`~/.config/agent-bios/corpus`; native host-home settings do not relocate it.
|
|
105
|
+
`--config-dir` is restricted to explicit legacy mode. Use `--no-upload` for
|
|
106
|
+
local-only capture or `--dry-run` to validate without writes or uploads.
|
|
96
107
|
|
|
97
108
|
**Never** hand-author `learning_id` / `created` / `schema_version`, and never
|
|
98
109
|
write those files directly. If the script REJECTS a record, fix the semantic
|
|
@@ -13,7 +13,7 @@ core_rules:
|
|
|
13
13
|
- the ledger is the SSOT for state; read it before touching the pipeline
|
|
14
14
|
- placement follows PLACEMENT-FRAMEWORK.md, never ad-hoc judgment
|
|
15
15
|
- every promotion passes an explicit user-approval gate
|
|
16
|
-
-
|
|
16
|
+
- the canonical always surface is frozen to reductions; route additions to guides, skills, or session-level injection
|
|
17
17
|
- close the window by updating mirrors, parity, deployment, and the nudge baseline
|
|
18
18
|
---
|
|
19
19
|
|
|
@@ -85,10 +85,13 @@ Everything durable lives in the agent-bios repo.
|
|
|
85
85
|
promoted, and what is still incubating are all queries against this file.
|
|
86
86
|
Read state here and nowhere else: a count or a status written into prose is
|
|
87
87
|
correct on the day it is written and silently wrong afterwards.
|
|
88
|
-
2. `design/session-distill/versions.json` —
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
88
|
+
2. `design/session-distill/versions.json` — authoring provenance mapping each
|
|
89
|
+
closed mining window to its commit. Private rollback selects an installed
|
|
90
|
+
`baseline_ref` through the corpus plan; this registry is not that authority.
|
|
91
|
+
3. `design/session-distill/PLACEMENT-FRAMEWORK.md` — the placement framework
|
|
92
|
+
(typology A–G, layers, admission bars, lifecycle). Apply the current
|
|
93
|
+
`AGENTS.md` reductions-only rule and `SURFACES.md` delivery contract when
|
|
94
|
+
choosing a destination; the framework does not authorize global growth.
|
|
92
95
|
|
|
93
96
|
## Stage 1 — Mine (pipeline in `session-distill/`)
|
|
94
97
|
|
|
@@ -140,15 +143,18 @@ Run in order; each stage reads the previous stage's `out/`:
|
|
|
140
143
|
consumer check (hermetic dispatch and scripts read no prose) → admission
|
|
141
144
|
bar → token estimate. Ambiguity stays PROPOSED for the user.
|
|
142
145
|
- Apply canonical-first, on a branch, stepwise commits: canonical guide text
|
|
143
|
-
→
|
|
144
|
-
|
|
146
|
+
→ reductions to the canonical always surface (delete, merge, or move rules
|
|
147
|
+
out; additions belong in guides, skills, or session-level injection) → other guides →
|
|
145
148
|
hooks (derive injected text from the canonical guide; read-only, never
|
|
146
149
|
blocking) → enforcement in owned wrappers (loud failures; keep
|
|
147
150
|
stdout/stderr channel contracts) → codex/ + ko/ mirrors.
|
|
148
151
|
- Verify per layer, not just by diff: enforcement/gate fixture tests
|
|
149
152
|
(non-vacuous — known-bad must fire), hook trigger positive/negative sets,
|
|
150
153
|
`gates/check-parity.sh` exit 0 unpiped, prompting-target gate, then
|
|
151
|
-
`
|
|
154
|
+
`bash install.sh install` from this checkout to store the changed private
|
|
155
|
+
release and `bash install.sh verify` to verify it. Activate a new configured
|
|
156
|
+
session through `agent-launch` and check its delivery evidence separately;
|
|
157
|
+
installation does not activate content or change an existing session pin.
|
|
152
158
|
|
|
153
159
|
## Stage 4 — G-pass (principles, not directives)
|
|
154
160
|
|
|
@@ -165,10 +171,14 @@ Run in order; each stage reads the previous stage's `out/`:
|
|
|
165
171
|
|
|
166
172
|
1. Ledger: statuses to placed (with implementation paths) / incubating;
|
|
167
173
|
dated corrections for anything refuted.
|
|
168
|
-
2.
|
|
174
|
+
2. Write a new timestamped completion record under `design/session-distill/`
|
|
175
|
+
following `AGENTS.md`; incidental finds become next-window candidates.
|
|
169
176
|
3. Register the corpus version: append {version = window end, commit = the
|
|
170
|
-
corpus-close commit} to `design/session-distill/versions.json`
|
|
171
|
-
|
|
177
|
+
corpus-close commit} to `design/session-distill/versions.json` for authoring provenance. Private rollback selects an installed `baseline_ref`
|
|
178
|
+
through `agent-bios corpus plan`; the window registry does not authorize a
|
|
179
|
+
global-file rollback. Then run
|
|
172
180
|
`python3 session-distill/update-state.py --window-end <date>`
|
|
173
181
|
(nudge baseline) and `corpus-state.py project` (launcher status panel).
|
|
174
|
-
4. Merge the branch, push, and confirm
|
|
182
|
+
4. Merge the branch, push, and confirm the private release from this checkout
|
|
183
|
+
(`bash install.sh verify`); report stored-state and session-delivery evidence
|
|
184
|
+
separately.
|
package/codex/AGENTS.md
CHANGED
|
@@ -115,4 +115,4 @@
|
|
|
115
115
|
|
|
116
116
|
## Session Learning
|
|
117
117
|
|
|
118
|
-
- `learn!` — session learning: when the user enters `learn
|
|
118
|
+
- `learn!` — session learning: when the user enters `learn!`, capture durable lessons from THIS session for future selected sessions and configured org curation. Read `${CODEX_HOME:-$HOME/.codex}/guides/learning-flow.md` and follow its admission bar → type A–G → intended layer → explicit user approval → package-bound submission. The tool owns id/timestamp and private capture; it preserves native globals. A Session distill preset (`distill!`) owns its capture — do not run both flows. Never manufacture Type-G principles user-side (curator-only).
|
|
@@ -233,7 +233,7 @@ Write for the next agent and re-verification, not narrative. Required content:
|
|
|
233
233
|
|
|
234
234
|
## Environment Binding (edit per environment)
|
|
235
235
|
|
|
236
|
-
This is the human-readable projection of concrete models/tools; `launch/agent-launch.toml` is the machine launch authority and parity checks keep them aligned. Re-probe when the binding is older than ~8 weeks or a newer observable model/tool changes the surface.
|
|
236
|
+
This is the human-readable projection of concrete models/tools; `launch/agent-launch.toml` is the machine launch authority and parity checks keep them aligned. Re-probe when the binding is older than ~8 weeks or a newer observable model/tool changes the surface. Edit shipped defaults in the source repository; keep personal launch bindings in user-owned launcher configuration. Private installation stores an immutable release and preserves personal state. A new configured session resolves its bindings; existing session pins retain theirs.
|
|
237
237
|
|
|
238
238
|
Binding (2026-09-08):
|
|
239
239
|
|
|
@@ -9,14 +9,15 @@ use_when:
|
|
|
9
9
|
core_rules:
|
|
10
10
|
- three gates BEFORE asking the user — admission bar, type, consumption layer
|
|
11
11
|
- the user approves every recorded learning; nothing is written without it
|
|
12
|
-
- submit ONLY through
|
|
12
|
+
- submit ONLY through the package-bound learn command below; never hand-write the record
|
|
13
13
|
---
|
|
14
14
|
|
|
15
15
|
# Session learning flow (`learn!`)
|
|
16
16
|
|
|
17
17
|
The **light**, per-user, single-session capture flow: turn a lesson from the
|
|
18
18
|
current session into a **learning** (prose + a JSON record) that (a) applies to
|
|
19
|
-
the user's
|
|
19
|
+
the user's future selected, activated sessions and (b) reaches the org for curation
|
|
20
|
+
when transport is configured. This is the
|
|
20
21
|
counterpart of the **heavy** session-distill pipeline (`distill!`), which mines
|
|
21
22
|
many sessions and is curator/power-user only. Terminology and the full routing
|
|
22
23
|
framework are maintained in the agent-bios repo; the criteria this flow applies
|
|
@@ -75,6 +76,14 @@ Surface each surviving candidate compactly — lesson, type, intended layer,
|
|
|
75
76
|
admission-bar verdict, domain (+ proposed_domain) — and record ONLY what the
|
|
76
77
|
user explicitly approves.
|
|
77
78
|
|
|
79
|
+
In a Codex app task using the explicit corpus bridge, use the `learn` command
|
|
80
|
+
and environment returned in its `runtime` metadata, or its registered helper.
|
|
81
|
+
Shell exports from an earlier app tool call do not persist into later calls.
|
|
82
|
+
|
|
83
|
+
In a launcher-activated session, invoke `learn` through the supplied
|
|
84
|
+
`AGENT_BIOS_PACKAGE_ROOT` as shown below. Outside an activated session, resolve
|
|
85
|
+
the installed `agent-bios` executable and use its `learn` subcommand.
|
|
86
|
+
|
|
78
87
|
Submit each approved learning through the deterministic submit tool. Pass your
|
|
79
88
|
session's `--host` and pipe the **semantic payload only** as one JSON object on
|
|
80
89
|
stdin (set the `supporting_sessions` tool prefix — `claude:` or `codex:` — to
|
|
@@ -83,16 +92,18 @@ match your host):
|
|
|
83
92
|
echo '{"lesson":"…","domain":"builder-base","supporting_sessions":["<tool>:<session-short-id>"],
|
|
84
93
|
"criteria":["recurrent_error"],
|
|
85
94
|
"classification":{"type":"B","layer":"hook","meets_bar":true}}' \
|
|
86
|
-
|
|
|
87
|
-
|
|
88
|
-
The script (capability boundary) owns `learning_id` / `created` / `schema_version
|
|
89
|
-
validates against `learn/learning.schema.json
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
95
|
+
| bash "$AGENT_BIOS_PACKAGE_ROOT/install.sh" learn --host <claude|codex>
|
|
96
|
+
|
|
97
|
+
The script (capability boundary) owns `learning_id` / `created` / `schema_version`
|
|
98
|
+
and validates against `learn/learning.schema.json`. It appends the record to the
|
|
99
|
+
private corpus's `learnings/<host>/events.jsonl`, keeping Claude and Codex captures
|
|
100
|
+
separate. Selected learnings enter future activated-session snapshots through the
|
|
101
|
+
private corpus. Capture preserves the user's global instruction files and the
|
|
102
|
+
running session's snapshot. Upload runs after local storage when transport is configured.
|
|
103
|
+
The private root is `$AGENT_BIOS_CORPUS_DIR`, defaulting to
|
|
104
|
+
`~/.config/agent-bios/corpus`; native host-home settings do not relocate it.
|
|
105
|
+
`--config-dir` is restricted to explicit legacy mode. Use `--no-upload` for
|
|
106
|
+
local-only capture or `--dry-run` to validate without writes or uploads.
|
|
96
107
|
|
|
97
108
|
**Never** hand-author `learning_id` / `created` / `schema_version`, and never
|
|
98
109
|
write those files directly. If the script REJECTS a record, fix the semantic
|
|
@@ -13,7 +13,7 @@ core_rules:
|
|
|
13
13
|
- the ledger is the SSOT for state; read it before touching the pipeline
|
|
14
14
|
- placement follows PLACEMENT-FRAMEWORK.md, never ad-hoc judgment
|
|
15
15
|
- every promotion passes an explicit user-approval gate
|
|
16
|
-
-
|
|
16
|
+
- the canonical always surface is frozen to reductions; route additions to guides, skills, or session-level injection
|
|
17
17
|
- close the window by updating mirrors, parity, deployment, and the nudge baseline
|
|
18
18
|
---
|
|
19
19
|
|
|
@@ -85,10 +85,13 @@ Everything durable lives in the agent-bios repo.
|
|
|
85
85
|
promoted, and what is still incubating are all queries against this file.
|
|
86
86
|
Read state here and nowhere else: a count or a status written into prose is
|
|
87
87
|
correct on the day it is written and silently wrong afterwards.
|
|
88
|
-
2. `design/session-distill/versions.json` —
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
88
|
+
2. `design/session-distill/versions.json` — authoring provenance mapping each
|
|
89
|
+
closed mining window to its commit. Private rollback selects an installed
|
|
90
|
+
`baseline_ref` through the corpus plan; this registry is not that authority.
|
|
91
|
+
3. `design/session-distill/PLACEMENT-FRAMEWORK.md` — the placement framework
|
|
92
|
+
(typology A–G, layers, admission bars, lifecycle). Apply the current
|
|
93
|
+
`AGENTS.md` reductions-only rule and `SURFACES.md` delivery contract when
|
|
94
|
+
choosing a destination; the framework does not authorize global growth.
|
|
92
95
|
|
|
93
96
|
## Stage 1 — Mine (pipeline in `session-distill/`)
|
|
94
97
|
|
|
@@ -140,15 +143,18 @@ Run in order; each stage reads the previous stage's `out/`:
|
|
|
140
143
|
consumer check (hermetic dispatch and scripts read no prose) → admission
|
|
141
144
|
bar → token estimate. Ambiguity stays PROPOSED for the user.
|
|
142
145
|
- Apply canonical-first, on a branch, stepwise commits: canonical guide text
|
|
143
|
-
→
|
|
144
|
-
|
|
146
|
+
→ reductions to the canonical always surface (delete, merge, or move rules
|
|
147
|
+
out; additions belong in guides, skills, or session-level injection) → other guides →
|
|
145
148
|
hooks (derive injected text from the canonical guide; read-only, never
|
|
146
149
|
blocking) → enforcement in owned wrappers (loud failures; keep
|
|
147
150
|
stdout/stderr channel contracts) → codex/ + ko/ mirrors.
|
|
148
151
|
- Verify per layer, not just by diff: enforcement/gate fixture tests
|
|
149
152
|
(non-vacuous — known-bad must fire), hook trigger positive/negative sets,
|
|
150
153
|
`gates/check-parity.sh` exit 0 unpiped, prompting-target gate, then
|
|
151
|
-
`
|
|
154
|
+
`bash install.sh install` from this checkout to store the changed private
|
|
155
|
+
release and `bash install.sh verify` to verify it. Activate a new configured
|
|
156
|
+
session through `agent-launch` and check its delivery evidence separately;
|
|
157
|
+
installation does not activate content or change an existing session pin.
|
|
152
158
|
|
|
153
159
|
## Stage 4 — G-pass (principles, not directives)
|
|
154
160
|
|
|
@@ -165,10 +171,14 @@ Run in order; each stage reads the previous stage's `out/`:
|
|
|
165
171
|
|
|
166
172
|
1. Ledger: statuses to placed (with implementation paths) / incubating;
|
|
167
173
|
dated corrections for anything refuted.
|
|
168
|
-
2.
|
|
174
|
+
2. Write a new timestamped completion record under `design/session-distill/`
|
|
175
|
+
following `AGENTS.md`; incidental finds become next-window candidates.
|
|
169
176
|
3. Register the corpus version: append {version = window end, commit = the
|
|
170
|
-
corpus-close commit} to `design/session-distill/versions.json`
|
|
171
|
-
|
|
177
|
+
corpus-close commit} to `design/session-distill/versions.json` for authoring provenance. Private rollback selects an installed `baseline_ref`
|
|
178
|
+
through `agent-bios corpus plan`; the window registry does not authorize a
|
|
179
|
+
global-file rollback. Then run
|
|
172
180
|
`python3 session-distill/update-state.py --window-end <date>`
|
|
173
181
|
(nudge baseline) and `corpus-state.py project` (launcher status panel).
|
|
174
|
-
4. Merge the branch, push, and confirm
|
|
182
|
+
4. Merge the branch, push, and confirm the private release from this checkout
|
|
183
|
+
(`bash install.sh verify`); report stored-state and session-delivery evidence
|
|
184
|
+
separately.
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: agent-bios
|
|
3
|
+
description: Set up or reconfigure agent-bios through conversation, manage its private corpus, or explicitly use corpus context in this Codex task. Loading this skill alone does not activate corpus content.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# agent-bios in this task
|
|
7
|
+
|
|
8
|
+
Use the [bridge helper](scripts/bridge.py) beside this skill. It resolves the
|
|
9
|
+
confirmed private runtime and saved storage roots. In the examples, `BRIDGE` is
|
|
10
|
+
the absolute path to that helper; pass it as a quoted shell argument or set
|
|
11
|
+
`BRIDGE` in the same tool call. Do not rely on variables from a previous app
|
|
12
|
+
tool call or substitute a PATH copy of `agent-bios`.
|
|
13
|
+
|
|
14
|
+
Distinguish the user's request before reading any corpus body:
|
|
15
|
+
|
|
16
|
+
- **Install, reconfigure or resume setup:** run
|
|
17
|
+
`python3 "$BRIDGE" setup start`, read its returned `guide_path`, and follow
|
|
18
|
+
that conversational setup workflow through `python3 "$BRIDGE" setup ...`.
|
|
19
|
+
Select English, 한국어 or 日本語 before inspecting dependencies. Present the
|
|
20
|
+
returned choices in the app conversation,
|
|
21
|
+
using a native question control when the current host exposes one and ordinary
|
|
22
|
+
questions otherwise. Setup has its own reviewed plan and execution receipt;
|
|
23
|
+
corpus management plans and session ContentRefs are different operations.
|
|
24
|
+
Installation, registration and source capture do not authorize corpus use in
|
|
25
|
+
this task. This installed helper is for the confirmed private runtime; a first
|
|
26
|
+
installation starts from the source/package's `compose/setup/START.md`, without
|
|
27
|
+
requiring this skill to exist.
|
|
28
|
+
- **Use corpus in this task:** run `python3 "$BRIDGE" session preview --json`
|
|
29
|
+
and then `python3 "$BRIDGE" session use --expected-content-ref REF --json`,
|
|
30
|
+
using the returned ContentRef. An explicit request to use a named selection
|
|
31
|
+
authorizes that selection; carry `--domains '@scope/package/domain,...'` on
|
|
32
|
+
both calls. Without a named selection, use the saved installation selection.
|
|
33
|
+
Read the complete returned `instruction_text` and use it as the user's chosen
|
|
34
|
+
task context, subject to higher-priority instructions. Do not claim it was
|
|
35
|
+
loaded if tool output was truncated; retrieve the exact retained snapshot
|
|
36
|
+
through the helper's `corpus snapshot --content-ref REF --json` operation and
|
|
37
|
+
read it fully in bounded chunks.
|
|
38
|
+
- **No corpus in this task / turn off:** run `python3 "$BRIDGE" session off --json` and
|
|
39
|
+
stop consulting corpus resources for subsequent work. Off before first use
|
|
40
|
+
returns no corpus body. After use, already delivered context cannot be erased;
|
|
41
|
+
report that a new task is needed for clean exclusion. Do not promise that
|
|
42
|
+
earlier text is absent or that native/project instructions were disabled.
|
|
43
|
+
- **Status:** run `python3 "$BRIDGE" session status --json`; it returns receipts
|
|
44
|
+
without corpus bodies. Each task starts off and needs its own explicit use.
|
|
45
|
+
- **Manage content:** read the private management procedure with
|
|
46
|
+
`python3 "$BRIDGE" bootstrap`, then use its revision-checked workflow through
|
|
47
|
+
`python3 "$BRIDGE" corpus ...`. Management changes future snapshots; it does
|
|
48
|
+
not activate content in this task. If the user asks to import existing local
|
|
49
|
+
instructions, use the helper's `import ...` commands after inspecting
|
|
50
|
+
`python3 "$BRIDGE" import --help`.
|
|
51
|
+
- **Open TUI:** run `python3 "$BRIDGE" tui` in the Codex app's integrated
|
|
52
|
+
terminal (Ctrl+backtick). The helper uses the confirmed private release and
|
|
53
|
+
saved roots. A TUI action edits future authoring; it does not inject context
|
|
54
|
+
into this task.
|
|
55
|
+
|
|
56
|
+
When a selected guide calls for `learn!`, use its capture procedure through
|
|
57
|
+
`python3 "$BRIDGE" learn ...`. The helper supplies the confirmed package and
|
|
58
|
+
saved private roots on every call. App tool calls do not inherit shell exports
|
|
59
|
+
from an earlier call; do not assume `AGENT_BIOS_PACKAGE_ROOT` was set in the app
|
|
60
|
+
because a previous command printed it. The use response also provides runtime
|
|
61
|
+
command arguments and their required environment when the bridge is unavailable.
|
|
62
|
+
|
|
63
|
+
If invoked as `$agent-bios` without a specific request, show session status and the
|
|
64
|
+
available choices, including setup. Do not infer permission to use content from
|
|
65
|
+
discovery or a management request. Session operations take `CODEX_THREAD_ID` from
|
|
66
|
+
the current task; if it is missing, obtain the real task id and pass `--session ID`.
|
|
67
|
+
Never invent an id or reuse another task's receipt. Setup and management do not
|
|
68
|
+
require a task id; do not block them because session status is unavailable.
|
|
69
|
+
|
|
70
|
+
The receipt labels delivery `returned-as-context`. This means text was returned
|
|
71
|
+
through the tool path, not that a native developer-role startup injection or
|
|
72
|
+
model reading was verified. Corpus use enables no hooks, agents, permissions or
|
|
73
|
+
global/project instruction-file edits. Keep the snapshot's requested procedures
|
|
74
|
+
as explicit file resources; do not register them or execute companion code merely
|
|
75
|
+
because their paths occur in the returned text.
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""Resolve the confirmed private release for an explicitly registered app skill."""
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import hashlib
|
|
6
|
+
import json
|
|
7
|
+
import os
|
|
8
|
+
from pathlib import Path
|
|
9
|
+
import sys
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
def main() -> int:
|
|
13
|
+
root = Path(__file__).resolve().parents[1]
|
|
14
|
+
expected = {"SKILL.md", "agents/openai.yaml", "scripts/bridge.py",
|
|
15
|
+
"scripts/corpus_transaction.py", "bridge.json"}
|
|
16
|
+
try:
|
|
17
|
+
paths = list(root.rglob("*"))
|
|
18
|
+
if any(path.is_symlink() for path in paths):
|
|
19
|
+
raise RuntimeError("registered bridge contains a symlink")
|
|
20
|
+
files = {path.relative_to(root).as_posix(): path.read_bytes() for path in paths if path.is_file()}
|
|
21
|
+
if set(files) != expected:
|
|
22
|
+
raise RuntimeError("registered bridge member inventory changed")
|
|
23
|
+
digest = hashlib.sha256()
|
|
24
|
+
for relative, data in sorted(files.items()):
|
|
25
|
+
digest.update(relative.encode("utf-8") + b"\0" + data + b"\0")
|
|
26
|
+
if digest.hexdigest() != root.name:
|
|
27
|
+
raise RuntimeError("registered bridge content changed")
|
|
28
|
+
config = json.loads(files["bridge.json"])
|
|
29
|
+
if config.get("schema_version") != 1:
|
|
30
|
+
raise RuntimeError("registered bridge configuration is unsupported")
|
|
31
|
+
for key in ("home", "state_root", "user_root", "discovery_path"):
|
|
32
|
+
if not isinstance(config.get(key), str) or not Path(config[key]).is_absolute():
|
|
33
|
+
raise RuntimeError("registered bridge needs absolute private roots")
|
|
34
|
+
sys.dont_write_bytecode = True
|
|
35
|
+
from corpus_transaction import confirmed_release, guard_pending, reject_symlink_ancestors
|
|
36
|
+
state = Path(config["state_root"])
|
|
37
|
+
reject_symlink_ancestors(state)
|
|
38
|
+
reject_symlink_ancestors(Path(config["user_root"]))
|
|
39
|
+
guard_pending(state)
|
|
40
|
+
release = confirmed_release(state)
|
|
41
|
+
reject_symlink_ancestors(release)
|
|
42
|
+
env = dict(os.environ)
|
|
43
|
+
env.update({"HOME": config["home"], "AGENT_BIOS_STATE_DIR": config["state_root"],
|
|
44
|
+
"AGENT_BIOS_CORPUS_DIR": config["user_root"],
|
|
45
|
+
"AGENT_BIOS_PACKAGE_ROOT": str(release), "AGENT_BIOS_PRIVATE_CORPUS": "1",
|
|
46
|
+
"AGENT_BIOS_LEGACY_INSTALL": "0",
|
|
47
|
+
"PYTHONDONTWRITEBYTECODE": "1"})
|
|
48
|
+
if "launch_venv" in config:
|
|
49
|
+
value = config["launch_venv"]
|
|
50
|
+
if not isinstance(value, str) or (value and not Path(value).is_absolute()):
|
|
51
|
+
raise RuntimeError("registered bridge has an invalid managed runtime path")
|
|
52
|
+
env["AGENT_LAUNCH_VENV"] = value
|
|
53
|
+
args = sys.argv[1:]
|
|
54
|
+
command = args[0] if args else "session"
|
|
55
|
+
tail = args[1:] if args else ["status", "--json"]
|
|
56
|
+
if command == "bootstrap":
|
|
57
|
+
print((release / "compose/bootstrap/SKILL.md").read_text(encoding="utf-8"), end="")
|
|
58
|
+
return 0
|
|
59
|
+
if command == "tui":
|
|
60
|
+
argv = ["/bin/bash", str(release / "install.sh"), "corpus", *tail]
|
|
61
|
+
elif command in {"setup", "corpus", "import", "learn"}:
|
|
62
|
+
argv = ["/bin/bash", str(release / "install.sh"), command, *tail]
|
|
63
|
+
elif command == "session":
|
|
64
|
+
argv = [sys.executable, str(release / "compose/corpus_app.py"), "--repo", str(release),
|
|
65
|
+
"--state-dir", config["state_root"], "--user-dir", config["user_root"], "session", *tail]
|
|
66
|
+
else:
|
|
67
|
+
raise RuntimeError("bridge supports setup, session, corpus, import, learn, bootstrap and tui")
|
|
68
|
+
os.execve(argv[0], argv, env)
|
|
69
|
+
except (OSError, RuntimeError, ValueError, KeyError) as exc:
|
|
70
|
+
print(f"agent-bios app bridge: {exc}", file=sys.stderr)
|
|
71
|
+
return 2
|
|
72
|
+
return 0
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
if __name__ == "__main__":
|
|
76
|
+
raise SystemExit(main())
|
|
@@ -1,10 +1,21 @@
|
|
|
1
1
|
---
|
|
2
|
-
name:
|
|
2
|
+
name: agent-bios
|
|
3
3
|
description: Inspect or change the private agent-bios corpus used by activated sessions, including item creation, edits, consumption placement, enablement, removal, restore, recovery, selection, reset, rollback, history, and current-vs-pinned explanation. Use for requests about the user's agent-bios instructions or personal learnings; it does not alter the running session or native global files.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# Corpus management
|
|
7
7
|
|
|
8
|
+
For installation, dependency choices or setup reconfiguration, read
|
|
9
|
+
`compose/setup/START.md` from the confirmed `AGENT_BIOS_PACKAGE_ROOT` and use
|
|
10
|
+
`bash "$AGENT_BIOS_PACKAGE_ROOT/install.sh" setup ...`. In an app task, the
|
|
11
|
+
registered helper's `setup start` returns the guide path and its `setup ...`
|
|
12
|
+
operations supply the confirmed runtime and saved roots on every tool call.
|
|
13
|
+
A completed setup can return that helper path before native discovery refreshes;
|
|
14
|
+
use the returned path directly.
|
|
15
|
+
Do not copy this private bootstrap into host discovery or register a second
|
|
16
|
+
personal skill named `agent-bios`. Setup does not activate corpus in the current
|
|
17
|
+
task; use the app bridge's explicit session-use procedure when requested.
|
|
18
|
+
|
|
8
19
|
For a guided conversation about why a corpus bundle exists and how its rules work,
|
|
9
20
|
use the `understand!` / `$understand` skill. `agent-bios understand list` lists
|
|
10
21
|
learning bundles; `agent-launch --understand BUNDLE claude` (or `codex`) opens a
|
package/compose/corpus.py
CHANGED
|
@@ -86,6 +86,9 @@ def build_parser() -> argparse.ArgumentParser:
|
|
|
86
86
|
snapshot_view.add_argument("--host", choices=("claude", "codex"))
|
|
87
87
|
snapshot_view.add_argument("--content-ref", help="read this stored snapshot without resolving current authoring")
|
|
88
88
|
snapshot.add_argument("--native", action="store_true", help="opt into selected native hooks on either host and Claude agents for this snapshot")
|
|
89
|
+
snapshot.add_argument("--selection-mode", choices=("default", "selected", "none"))
|
|
90
|
+
snapshot.add_argument("--select", action="append", help="one-session package/domain/item selection")
|
|
91
|
+
snapshot.add_argument("--cwd", type=Path, help="project scope for this snapshot")
|
|
89
92
|
|
|
90
93
|
install = sub.add_parser("install", help="record the current package as a private baseline")
|
|
91
94
|
install.add_argument("--domains", help="comma-separated qualified selection values")
|
|
@@ -177,10 +180,12 @@ def run_command(args: argparse.Namespace, store: CorpusStore) -> Any:
|
|
|
177
180
|
return store.status()
|
|
178
181
|
if command == "snapshot":
|
|
179
182
|
if args.content_ref:
|
|
180
|
-
if args.native:
|
|
181
|
-
raise CorpusStoreError("a stored snapshot is immutable;
|
|
183
|
+
if args.native or args.selection_mode or args.select or args.cwd:
|
|
184
|
+
raise CorpusStoreError("a stored snapshot is immutable; selection and scope options require --host")
|
|
182
185
|
return store.snapshot_inventory(args.content_ref)
|
|
183
|
-
return store.snapshot(args.host, native=args.native
|
|
186
|
+
return store.snapshot(args.host, selection=args.select, native=args.native,
|
|
187
|
+
selection_mode=args.selection_mode or ("selected" if args.select is not None else None),
|
|
188
|
+
cwd=args.cwd)
|
|
184
189
|
if command == "install":
|
|
185
190
|
domains = None
|
|
186
191
|
if args.domains is not None:
|
|
@@ -328,14 +333,16 @@ def _run_tui_or_fallback(args: argparse.Namespace, store: CorpusStore) -> int:
|
|
|
328
333
|
module_name = f"{__package__}.corpus_ui" if __package__ else "corpus_ui"
|
|
329
334
|
try:
|
|
330
335
|
module = importlib.import_module(module_name)
|
|
331
|
-
except
|
|
332
|
-
|
|
336
|
+
except ImportError as exc:
|
|
337
|
+
missing_ui_dependency = any(exc.name == name or (exc.name or "").startswith(name + ".")
|
|
338
|
+
for name in ("textual", "rich"))
|
|
339
|
+
if not missing_ui_dependency and exc.name not in {"corpus_ui", module_name}:
|
|
333
340
|
raise
|
|
334
341
|
interpreter = venv_python()
|
|
335
342
|
if (
|
|
336
|
-
|
|
343
|
+
missing_ui_dependency
|
|
337
344
|
and interpreter is not None
|
|
338
|
-
and Path(sys.executable).
|
|
345
|
+
and Path(sys.executable).absolute() != interpreter.absolute()
|
|
339
346
|
and os.environ.get("AGENT_BIOS_CORPUS_TUI_REEXEC") != "1"
|
|
340
347
|
):
|
|
341
348
|
env = os.environ.copy()
|
|
@@ -358,7 +365,20 @@ def _run_tui_or_fallback(args: argparse.Namespace, store: CorpusStore) -> int:
|
|
|
358
365
|
return 0
|
|
359
366
|
|
|
360
367
|
|
|
361
|
-
def
|
|
368
|
+
def _run_bundled_tui(store: CorpusStore) -> int:
|
|
369
|
+
try:
|
|
370
|
+
from corpus_ui_runtime import activate_ui_runtime
|
|
371
|
+
activate_ui_runtime(Path(__file__).resolve().parents[1])
|
|
372
|
+
module_name = f"{__package__}.corpus_ui" if __package__ else "corpus_ui"
|
|
373
|
+
module = importlib.import_module(module_name)
|
|
374
|
+
except (ImportError, OSError, RuntimeError) as exc:
|
|
375
|
+
raise CorpusStoreError(f"bundled terminal UI could not start: {exc}") from exc
|
|
376
|
+
app = module.CorpusStudio(store)
|
|
377
|
+
app.run()
|
|
378
|
+
return 0
|
|
379
|
+
|
|
380
|
+
|
|
381
|
+
def main(argv: Sequence[str] | None = None, *, bundled_ui: bool = False) -> int:
|
|
362
382
|
parser = build_parser()
|
|
363
383
|
raw = list(sys.argv[1:] if argv is None else argv)
|
|
364
384
|
# Machine callers naturally put --json after the verb. argparse only accepts
|
|
@@ -372,6 +392,8 @@ def main(argv: Sequence[str] | None = None) -> int:
|
|
|
372
392
|
try:
|
|
373
393
|
if args.command is None:
|
|
374
394
|
if sys.stdin.isatty() and sys.stdout.isatty():
|
|
395
|
+
if bundled_ui:
|
|
396
|
+
return _run_bundled_tui(store)
|
|
375
397
|
return _run_tui_or_fallback(args, store)
|
|
376
398
|
args.command = "list"
|
|
377
399
|
args.active_only = False
|
|
@@ -384,4 +406,4 @@ def main(argv: Sequence[str] | None = None) -> int:
|
|
|
384
406
|
|
|
385
407
|
|
|
386
408
|
if __name__ == "__main__":
|
|
387
|
-
raise SystemExit(main())
|
|
409
|
+
raise SystemExit(main(bundled_ui=True))
|