agent-bios 0.1.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.
Files changed (35) hide show
  1. package/DEPENDENCIES.md +89 -0
  2. package/LICENSE +21 -0
  3. package/README.md +86 -0
  4. package/claude/CLAUDE.md +138 -0
  5. package/claude/guides/cli-multi-model-workflow.md +194 -0
  6. package/claude/guides/coding-staged-workflow.md +70 -0
  7. package/claude/guides/implementation-map.md +34 -0
  8. package/claude/guides/llm-capability-boundary-examples.md +123 -0
  9. package/claude/guides/llm-capability-boundary-patterns.md +339 -0
  10. package/claude/guides/llm-capability-boundary.md +255 -0
  11. package/claude/guides/mock-realization-boundary.md +275 -0
  12. package/claude/guides/svg-visualization-guide.md +321 -0
  13. package/codex/AGENTS.md +139 -0
  14. package/codex/agents/frontier.toml +8 -0
  15. package/codex/agents/reviewer.toml +9 -0
  16. package/codex/agents/sweep.toml +9 -0
  17. package/codex/agents/workhorse.toml +8 -0
  18. package/codex/guides/cli-multi-model-workflow.md +194 -0
  19. package/codex/guides/coding-staged-workflow.md +70 -0
  20. package/codex/guides/implementation-map.md +34 -0
  21. package/codex/guides/llm-capability-boundary-examples.md +123 -0
  22. package/codex/guides/llm-capability-boundary-patterns.md +339 -0
  23. package/codex/guides/llm-capability-boundary.md +255 -0
  24. package/codex/guides/mock-realization-boundary.md +275 -0
  25. package/codex/guides/svg-visualization-guide.md +321 -0
  26. package/config/agent-launch.toml +94 -0
  27. package/package.json +54 -0
  28. package/scripts/agent-launch.py +1742 -0
  29. package/scripts/check-parity.sh +1703 -0
  30. package/scripts/codex-helm.sh +370 -0
  31. package/scripts/codex-run.sh +176 -0
  32. package/scripts/install.sh +310 -0
  33. package/scripts/provision-venv.sh +28 -0
  34. package/scripts/session-cost.py +106 -0
  35. package/shell/agent-launch.zsh +38 -0
@@ -0,0 +1,194 @@
1
+ ---
2
+ guide_id: cli-multi-model-workflow
3
+ language: en
4
+ status: active
5
+ use_when:
6
+ - work spans multiple models or CLI agents
7
+ - a handoff crosses a context reset, or parallel worktree branches run
8
+ - running unattended LLM batches or orchestrated subagent fleets
9
+ - allocating tiers, spawning subagents, or planning model switches
10
+ - resuming a halted staged pipeline or writing a handoff
11
+ ---
12
+
13
+ # CLI Multi-Model Workflow
14
+
15
+ Scoped extension of the global Multi-Model Workflow rules. Rules use portable role slots; only **Driving Codex CLI Directly** and **Environment Binding** name concrete tools or models.
16
+
17
+ ## When To Use
18
+
19
+ - Use for multiple models/agents, handoffs across clear/new sessions, unattended fleets, or parallel worktrees. Routine auto-compaction is not a handoff.
20
+ - Skip single-session, single-model work with no handoff.
21
+
22
+ ## Role Slots And Tiers
23
+
24
+ - FRONTIER: hardest bounded design, authority-changing decisions, triage, final verdicts.
25
+ - HELM: standing main/judgment seat; orchestration and bounded escalation.
26
+ - WORKHORSE: implementation volume and per-item judgments. SWEEP: cheap wide reads, candidate finding, mechanical passes.
27
+ - VERIFIER-A/B: different review kinds, preferably cross-family. INDEPENDENT-PR-REVIEWER: final review from a different family than the author.
28
+
29
+ - Bind concrete models in Environment Binding and allocate by **difficulty × blast radius**. The main defaults to HELM; first-of-kind/authority-changing mains use FRONTIER at a session boundary; trivial work stays direct.
30
+ - Apply the same allocation to subagents. Prefer spawning a bounded FRONTIER judgment over switching the loaded main; a context cannot switch its own model.
31
+ - Keep architecture, interfaces, scope, tradeoffs, and user-facing decisions in the main. Delegate volume work.
32
+ - A cheaper implementation tier requires stronger verification; never economize on both.
33
+
34
+ ## When To Spawn
35
+
36
+ Main-context pollution is usually costlier than spawn overhead. Apply these gates in order; the first that fires decides:
37
+
38
+ 1. **Independence:** verification or review always spawns; isolation is the purpose.
39
+ 2. **Parallelism:** independent items spawn in parallel with per-item tracking.
40
+ 3. **Residual context:** spawn work whose working log is much larger than the conclusion the main needs, such as broad reads, searches, tests, or implementation bursts.
41
+ 4. **Specifiability:** keep work local when it needs the main's live context or unresolved round-trips, especially deep debugging. Grind alone is not a FRONTIER reason.
42
+ 5. **De-minimis:** do work directly when its dispatch packet would be larger than the work.
43
+
44
+ - Escalate by spawning FRONTIER first; switch the main only when the judgment is not delegable.
45
+ - Every spawn gets a bounded report contract, artifact paths instead of pasted context, and an explicit model/effort pin. Never dump a worker transcript into the main.
46
+ - Explicit no-fan-out overrides standing authorization.
47
+
48
+ ## Delegation Mechanics And Teammate Persistence
49
+
50
+ Delegate execution, not decisions. A unit is delegable only when it is decision-complete, self-containedly specifiable, machine-checkable at done-when, and bounded in blast radius.
51
+
52
+ - Re-cut units containing unresolved choice, discovery-before-spec, untestable completion, or unfrozen interfaces. A worker asking which direction to take is a sizing failure; the decision returns to the main.
53
+ - Bundle related sub-floor tasks up to the decision-complete ceiling. A scout is read-only and reports file:line evidence for named pending decisions, probing the highest kill-risk unknown first.
54
+ - Prompt constants, thresholds, signatures, and judgment criteria are decisions even when stored in code. Discard decision-tainted worker output when review would cost more than a clean re-dispatch.
55
+ - Worker cost grows with request count × transcript prefix. Batch independent reads, minimize edit rounds, and dispatch independent workers/messages together.
56
+ - Use a resident teammate only for dependent slices in one burst. Verify that the CLI preserves its model and context; resume-after-completion may silently change both. Retire after the burst or cache TTL, and persist durable knowledge in files.
57
+ - After a discard or direction change, respawn once a routine round costs about as much as a fresh slice. Recover unique in-flight state to files first.
58
+ - Redirects to busy workers may queue rather than preempt. Check artifacts before destructive redirects, phrase them conditionally, and stop an actively harmful worker by scoped PID/worktree authority.
59
+ - Idle/progress notifications are hypotheses; verify repo artifacts before re-dispatch. Cross-reset state belongs in files, not task boards or transcripts.
60
+ - Review cost scales with the diff, so layered review preserves delegation savings. Lower reviewer tier before dropping a review kind.
61
+
62
+ ## Driving Codex CLI Directly
63
+
64
+ Instruction/config reach is per invocation. A rule in AGENTS.md cannot bind a hermetic worker; put required hermetic rules in its prompt/schema.
65
+
66
+ | Profile | Reach | Use |
67
+ |---|---|---|
68
+ | inherit | real `CODEX_HOME`, project cwd | full global/project AGENTS.md and user config |
69
+ | hermetic | temporary home, auth only, user config ignored | independent lens with prompt-owned criteria |
70
+ | custom | caller-populated home | exact curated instructions/config |
71
+
72
+ - Control instruction home, working directory, config overrides, task prompt, and output schema independently. The repo wrapper owns setup and teardown.
73
+ - Inherit review is discipline-aware; hermetic review is an independent kind. Confirm reach with a contrast phrase from AGENTS.md before trusting independence.
74
+ - Concrete flags, versions, sandbox defaults, and dispatch bindings live in Environment Binding.
75
+
76
+ ## Default Frame
77
+
78
+ | Stage | Owner | Artifact / exit |
79
+ |---|---|---|
80
+ | 0 Triage | current session | difficulty/blast-radius call; dials fixed |
81
+ | 1 Design | FRONTIER | dated design with measured background, done-when, concept map, allocation; owner approval |
82
+ | 2 Design verify | VERIFIER-A+B | findings union and revision; zero material issues |
83
+ | 3 Implement | WORKHORSE | smallest viable diff; deterministic gates green |
84
+ | 4 Implementation verify | SWEEP → WORKHORSE → FRONTIER | at least two reviewer kinds; strongest model on verdicts |
85
+ | 5 PR review | INDEPENDENT-PR-REVIEWER | clean cross-family review |
86
+ | 6 Merge verify | implementing session | freshly fetched merged state green |
87
+ | 7 Close | current session | docs/handoff synced; no silently parked items |
88
+
89
+ - A T1+ kickoff names the session model, orchestration authorization, this guide, and main-as-orchestrator delegation mode.
90
+ - T0 mechanical/low-risk uses stages 3→4 (→5 for shared merge); T1 normal work uses the full skeleton with a lightweight design; T2 authority-changing/first-of-kind/release work raises design and verdict review.
91
+ - Put stage transitions on context-reset boundaries so model changes are free and the design doubles as handoff. Keep a loaded session only when live state is load-bearing.
92
+ - Apply the **convergence heuristic by reviewer kind**: same-kind convergence raises confidence but shares blind spots; different-kind divergence is expected, so act on the union.
93
+ - If verification broadens the issue boundary, return to design and re-triage; the second identical loopback stops for owner choice. Halts resume from valid artifacts. Persist per-item outcomes.
94
+
95
+ ## Model Switching And The Prompt Cache
96
+
97
+ - Prompt caches are per model; each mid-session switch reprocesses the loaded transcript once. Batch work by model and switch at reset boundaries.
98
+ - Prefer a spawned FRONTIER decision. Switch the main only when context fidelity outweighs handoff cost and the judgment cannot be delegated.
99
+ - Avoid unplanned alternation. Planned escalate/return and explicit A/B comparisons are valid when each cache miss is budgeted.
100
+
101
+ ## Cross-Verification Economy
102
+
103
+ - Once cross-verification is warranted, keep kind diversity and tune effort first. Losing a kind loses an error class.
104
+ - Run deterministic gates before LLM review. Funnel SWEEP finders → WORKHORSE judgments → FRONTIER triage/verdicts.
105
+ - On family collapse, record the downgrade and label clean verdicts PROPOSED until diversity is restored.
106
+ - A silent/dead lens is incomplete, never clean. Confirm liveness from usage/error/report evidence; rerun, swap provider, or report PROPOSED.
107
+
108
+ ## Unattended Batch Safety
109
+
110
+ - The parent owns per-item completion and a **code-level circuit breaker**. For dispatchers you do not control, verify equivalent protection or attend the run.
111
+ - Default breaker: halt after 3 consecutive cross-item provider limit/auth/transport failures after bounded backoff. Persist undone items and alert or swap provider.
112
+ - Item-specific failures are poison items: cap at 2–3 attempts, then dead-letter them as complete-with-failure. Resume only unfinished/invalid items; whole-batch reruns require cheap idempotence.
113
+ - Persist per-item outcome, token, and cost records for recalibration.
114
+
115
+ ## Halt And Resume
116
+
117
+ - Resume-first from artifacts that parse, pass schema, and match their recorded source/config/HEAD fingerprint; unverifiable means invalid.
118
+ - Resubmit one invalid unit unless failures are broadly correlated, which is structural and halts the run.
119
+ - Treat halt→continue as normal operation.
120
+
121
+ ## Sessions, Branches, Worktrees
122
+
123
+ - Sessions bind to their starting directory. Use the CLI's native relocation/resume mechanism; never copy transcript files.
124
+ - For a new worktree, relocate natively or write a handoff and start fresh. Re-integrate branches serially and re-verify after each merge.
125
+ - Mark superseded worktrees/handoffs dead so later resume cannot select them.
126
+ - After resume/clear/relocation, verify pwd, branch, and HEAD against the pinned handoff before acting.
127
+
128
+ ## Handoff Contract
129
+
130
+ Write for the next agent and re-verification, not narrative. Required content:
131
+
132
+ 1. One-line current state.
133
+ 2. Pinned worktree, branch, HEAD, upstream/merge-base, author tier, and active fallback/family collapse.
134
+ 3. CONFIRMED claims whose cited command or anchored file evidence independently re-establishes them.
135
+ 4. Separate PROPOSED/OPEN items, including inherited claims not re-verified this session.
136
+ 5. Ordered next actions and the literal first command: model, orchestration authorization, and guide load for T1+.
137
+ 6. Credentials only by env-var/gitignored slot; scrub secrets from excerpts and commands.
138
+
139
+ - A broken evidence anchor demotes CONFIRMED to PROPOSED. If pinned state fails or no trustworthy handoff exists, rebuild from source artifacts and write a fresh handoff before acting.
140
+ - Store handoffs in the working repo's isolated dated docs path, never this instruction-SSOT repo. Re-verify load-bearing claims on resume.
141
+
142
+ ## Environment Binding (edit per environment)
143
+
144
+ This is the human-readable projection of concrete models/tools; `config/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. `agent-bios install` overwrites deployed bindings, so edit the repo copy.
145
+
146
+ Binding (2026-07-13):
147
+
148
+ | Slot | Binding | Notes |
149
+ |---|---|---|
150
+ | FRONTIER | Claude Fable 5 · GPT-5.6 Sol (read-only; max default, task-fit effort including Ultra) | bounded hardest decisions and verdicts |
151
+ | HELM | Claude Opus 4.8 (xhigh) · GPT-5.6 Sol (xhigh main; main Ultra requires explicit selection; bounded FRONTIER Ultra allowed) | standing main; Codex defaults bypass, explicit sandbox narrows |
152
+ | WORKHORSE | Claude Sonnet 5 · GPT-5.6 Terra (high) | implementation and per-item judgment |
153
+ | SWEEP | Claude Haiku 4.5 · GPT-5.6 Luna (low) | clear repeatable scans and mechanical work |
154
+ | VERIFIER-A | onto-mcp review | logic/authority kind; tier units per funnel |
155
+ | VERIFIER-B | `ultracode-for-codex` CLI v0.4.5 (Codex-backed; callable from Claude or Codex) | code/execution kind |
156
+ | INDEPENDENT-PR-REVIEWER | Codex CLI | adversarial `gh pr diff` review |
157
+ | Claude relocation | EnterWorktree, `/cd`, `--worktree`; resume is directory-scoped | verified 2.1.207 |
158
+ | Codex relocation | `codex resume` (cwd-filtered; `--all` lifts), fork | verified 0.144.1 |
159
+ | Claude teammate | named mailbox continuation; completed-agent message may cold-rerun on main model | keep resident; avoid completed resume |
160
+ | Rate-limit fallback | OpenAI limited → VERIFIER-A on Anthropic; Claude limited → VERIFIER-B on Codex | record family collapse |
161
+
162
+ Codex direct-drive (verified 0.144.1, 2026-07-12):
163
+
164
+ - `codex-helm` defaults the HELM main to `--dangerously-bypass-approvals-and-sandbox`; explicit `--sandbox` wins in any flag order. Non-Ultra defaults native multi-agent off; explicit main Ultra defaults it on.
165
+ - HELM is instructed to dispatch tiers through internal `codex-run`, which pins model/effort/sandbox. FRONTIER uses a separate `gpt-5.6-sol`, read-only root: max by default, Ultra for divisible work, lower effort when cost/latency dominates. Nested multi-agent is enabled only for Ultra. Native `codex exec` spawn cannot pin role/effort.
166
+ - This is an instruction-backed, live-E2E-verified default, not a security boundary: main bypass and arbitrary expert `-c` remain available by design. `frontier.toml` omits fixed effort for native surfaces that accept overrides.
167
+ - `codex-run` owns reach, stdin, schema, profiles, expert `-c`, channel preservation, and exit status. Keep it internal.
168
+
169
+ Dispatch packets:
170
+
171
+ | Target | Required packet / default |
172
+ |---|---|
173
+ | GPT-5.6 Sol FRONTIER | outcome, evidence, decision boundary, stop/verification; task-fit effort; read-only |
174
+ | GPT-5.6 Terra WORKHORSE | outcome, frozen scope/inputs, authority, done-when, evidence/report, escalation; high |
175
+ | GPT-5.6 Luna SWEEP | exact search space, rules, ambiguity behavior, stop, output; low; no architecture/debugging |
176
+ | Claude Opus 4.8 HELM | xhigh for agentic work; high minimum for sensitive judgment; lower only when bounded/cost-led |
177
+ | Claude Sonnet 5 WORKHORSE | exact scope, apply-to-all rules, tools, verification, report; high default |
178
+ | Claude Haiku 4.5 SWEEP | closed, high-volume, latency-sensitive work with exact schema/examples |
179
+
180
+ Use only task-relevant tools; parallelize independent calls. Worker report: `status`, `files_or_items_touched`, `evidence`, `verification`, `risks_or_escalations`. Official basis: OpenAI [model](https://developers.openai.com/api/docs/guides/latest-model?model=gpt-5.6), [migration](https://developers.openai.com/api/docs/guides/upgrading-to-gpt-5p6-sol), [prompting](https://developers.openai.com/api/docs/guides/prompt-guidance-gpt-5p6), [Codex models](https://learn.chatgpt.com/docs/models); Anthropic [subagents](https://code.claude.com/docs/en/sub-agents), [model effort](https://code.claude.com/docs/en/model-config).
181
+
182
+ ## Evidence Base
183
+
184
+ Single owner of numeric defaults; one production environment, 2026-07. Recalibration updates this table and dependent inline thresholds.
185
+
186
+ | Evidence | Result / rule supported |
187
+ |---|---|
188
+ | 15 sessions, 3,758 requests, 10 switches | switches consumed 13.9% of uncached input; avoid unplanned switching |
189
+ | 285-call limit incident | 208 post-limit dispatches and 34/35 lost items; breaker default 3 |
190
+ | 99 staged reviews | 15.2% halted after most compute; resume-first |
191
+ | three-task delegation probe | batched worker 5 requests/$0.23 vs loaded FRONTIER direct 6/$3.35; cache TTL 5 min; completed resume cost 2–5× |
192
+ | two live delegation sessions | tiering saved ~3.3×; discarded prefixes made fresh respawn cheaper; unpinned reviewers inherited FRONTIER |
193
+ | Codex reach contrast | inherit ~16.5K vs hermetic ~8.7K tokens; schema and stdout/stderr contract verified |
194
+ | Codex native-spawn probe + HELM E2E | requested max/Ultra native children recorded xhigh/role null; separate read-only roots recorded max and Ultra successfully |
@@ -0,0 +1,70 @@
1
+ ---
2
+ guide_id: coding-staged-workflow
3
+ language: en
4
+ status: active
5
+ use_when:
6
+ - meaningful development work needing execution depth, review loops, and stop conditions
7
+ - architecture changes, new features, cross-module or ontology changes, review-driven fixes
8
+ - the user asks to design ("설계") before implementation
9
+ - judging materiality of review findings and deciding when to stop or redesign
10
+ - choosing the per-domain verification mix (code, ontology, config/data, spreadsheets, docs)
11
+ ---
12
+
13
+ # Coding Guidelines: Staged Workflow
14
+
15
+ This guide is a scoped extension of the global Coding Guidelines. Use it for meaningful development work to choose execution depth, review loops, and stop conditions.
16
+
17
+ It operates inside the existing global rules for requested scope, concept economy, LLM/tools/code boundary, verification discipline, and documentation hygiene.
18
+
19
+ For trivial edits, use the lightweight inspect-edit-verify path from the global Coding Guidelines.
20
+
21
+ When the user asks to "설계" or design, stay in design mode. Focus on high-level design and implementation-process design, then present the plan, tradeoffs, review gates, and implementation trigger. Move to implementation after the user asks to implement or approves the plan.
22
+
23
+ ## When To Use
24
+
25
+ - Use this workflow for architecture changes, new features, cross-module behavior changes, ontology changes, review-driven fixes, or work that affects user-visible behavior, authority, lifecycle, validation, failure handling, or roadmap commitments.
26
+ - Use the lightweight path for small text edits, narrow config changes, or single-file adjustments whose completion criteria and verification are obvious.
27
+ - Increase workflow depth when new evidence shows broader risk than the initial request suggested.
28
+
29
+ ## Stages
30
+
31
+ 1. High-level design: define the goal, scope, architecture direction, affected concepts, tradeoffs, and completion criteria.
32
+ 2. Implementation-process design: turn the design into an ordered work plan with dependencies, verification points, review gates, and redesign triggers.
33
+ 3. Implementation: make the smallest viable functional changes that satisfy the approved design and process plan.
34
+
35
+ ## Review Loop
36
+
37
+ - At each stage, run review loops as appropriate: self review, subagent review when available, and structured multi-lens review when the repository or domain supports one (concrete tool: Environment Binding below).
38
+ - Iterate until material issues reach zero: review, identify material issues, fix them, and review again.
39
+ - Use the severity contract for materiality — the canonical definition is the ladder below; external review tools map their levels onto it: blocker, high, and medium are material; low and info are non-material.
40
+ - Treat blocker as primary happy-path or core-contract failure.
41
+ - Treat high as supported user, environment, data, or execution path failure.
42
+ - Treat medium as meaningful weakening of trust, auditability, reproducibility, completeness, or decision quality.
43
+ - Treat low and info as non-blocking unless requested or promoted by new evidence.
44
+
45
+ ## Verification Menus
46
+
47
+ Per-domain menus for the global Verification Discipline loop; pick the narrowest reliable mix that proves the changed behavior, meaning, or contract.
48
+
49
+ - Code: a layered mix of unit tests, integration tests for E2E segments, targeted E2E for changed flows, and full E2E for release or high-risk changes.
50
+ - Ontology: static graph checks, concept economy gates, changed-path integration checks, and competency-question E2E checks.
51
+ - Config or data: real parsers, schema checks, fixture validation, and sample transformations.
52
+ - Spreadsheets: static workbook checks, fixture-based output checks, cross-sheet flow checks, visual/layout checks, and real Microsoft Excel engine recalculation for formula-dependent results.
53
+ - Docs: links, terminology, current behavior alignment, and references to isolated historical notes.
54
+
55
+ ## Stop Conditions
56
+
57
+ - If the issue boundary expands compared with the previous review, stop and ask the user to choose redesign/rework or continuing the current iteration.
58
+ - Consider the boundary expanded when review reveals a broader affected purpose, failure condition, impact area, concept boundary, architecture boundary, or severity class.
59
+ - Before calling the work done, report the current stage, review results, remaining material issues, verification results, and any stop reason.
60
+
61
+ ## Environment Binding (edit per environment)
62
+
63
+ The only section of this guide that names concrete tools. Dated; expires ~8 weeks after the date or when the bound tool changes.
64
+
65
+ Binding (2026-07):
66
+
67
+ | Slot | Binding | Notes |
68
+ |---|---|---|
69
+ | Structured multi-lens review | onto-mcp review (private MCP) | consumes/emits the severity contract defined in Review Loop |
70
+ | Subagent review | host CLI's native review mechanism | e.g. Claude Code `/code-review` or Agent-tool reviewers |
@@ -0,0 +1,34 @@
1
+ ---
2
+ guide_id: implementation-map
3
+ language: en
4
+ status: active
5
+ use_when:
6
+ - creating or updating IMPLEMENTATION_MAP.html in a repo with implementation code
7
+ - building the single SVG service blueprint inside it
8
+ - deciding what belongs in the current-state dashboard vs isolated history notes
9
+ ---
10
+
11
+ # Implementation Map Guide
12
+
13
+ Scoped extension of the **Implementation Map** section of the global instructions. Use this when creating or updating `IMPLEMENTATION_MAP.html` for a repo with implementation code.
14
+
15
+ ## Purpose
16
+
17
+ `IMPLEMENTATION_MAP.html` is a **current-state dashboard** — it answers "where is this work now, what decides next, and what is at risk," not "what happened." It is not a changelog, handoff log, or accumulated project diary.
18
+
19
+ ## Build / rebuild rules
20
+
21
+ - Rebuild it around the current task, current architecture, current risks, current decisions, and current verification status.
22
+ - Compress completed history into the smallest useful summary; keep detailed past progress, abandoned alternatives, and long completed-task lists in isolated notes (`docs/`, `design/`, `archive/`).
23
+ - The first viewport must show current goal, phase, health, next decision, and main risk.
24
+ - Make it a self-contained HTML view with compact visual sections for status, architecture, roadmap, decisions, risks, verification, and change impact.
25
+ - Update it before committing, when writing a handoff, or after meaningful architecture, roadmap, risk, decision, or verification changes.
26
+
27
+ ## The SVG service blueprint
28
+
29
+ Include exactly **one** self-contained SVG service blueprint that visualizes the whole service or implemented system at the right level of abstraction. Build it using `${CODEX_HOME:-$HOME/.codex}/guides/svg-visualization-guide.md`.
30
+
31
+ - Keep the blueprint focused on a single judgment question; use compact nodes rather than exhaustive file or task lists.
32
+ - Use stable lanes, a legend, fixed role colors, short labels, and explicit arrows to separate: inputs, runtime/tools, LLM work, canonical artifacts, views, gates, quality checks, postponed work, and downstream/future work.
33
+ - Distinguish time flow from authority flow, and distinguish canonical artifacts from JSON/YAML/Markdown/HTML projections.
34
+ - Validate SVG syntax and layout hygiene when practical; ensure text does not overlap, and keep hot-path work visually separate from postponed or excluded work.
@@ -0,0 +1,123 @@
1
+ ---
2
+ guide_id: llm-capability-boundary-examples
3
+ parent: llm-capability-boundary
4
+ language: en
5
+ status: active
6
+ use_when:
7
+ - looking for worked precedents of boundary and field-authority design
8
+ - designing cases similar to sidecar submit, structured-output hybrid, MCP schema projection, or projection enrichment
9
+ ---
10
+
11
+ # LLM And Capability Boundary: Worked Examples
12
+
13
+ This guide is a scoped extension of
14
+ `${CODEX_HOME:-$HOME/.codex}/guides/llm-capability-boundary.md`.
15
+ Each example records a problem, the structural path taken, and the learning.
16
+
17
+ ## Lens Sidecar To Finding Ledger
18
+
19
+ Problem:
20
+
21
+ - Lens markdown was heterogeneous.
22
+ - Finding-ledger LLM had to reread and normalize noisy markdown.
23
+ - Runtime could not strongly guarantee ids, refs, artifact paths, or validation
24
+ scaffolds.
25
+
26
+ Structural path:
27
+
28
+ - Add `submit_lens_findings` as a batched submit tool.
29
+ - LLM submits semantic finding fields once.
30
+ - Runtime writes `round1/{lens}.findings.yaml`.
31
+ - Runtime owns `session_id`, `lens_id`, `candidate_id`, `source_ref`,
32
+ `human_output_ref`, validation, and YAML serialization.
33
+ - Optional markdown is rendered from the sidecar.
34
+ - When every lens output is a sidecar, runtime writes `finding-ledger.yaml`
35
+ deterministically.
36
+
37
+ Learning:
38
+
39
+ - Machine artifacts should not depend on LLM prose formatting.
40
+ - Batched submit reduces partial-output and per-call overhead.
41
+ - Prompt packets can become audit packets when runtime owns the artifact.
42
+ - A tool-capable route is required; text-only fallback should fail clearly for
43
+ this contract.
44
+
45
+ ## Structured Output Hybrid
46
+
47
+ Problem:
48
+
49
+ - Provider strict schema can enforce short enums.
50
+ - Long evidence refs can contain quotes or source text that make provider enum
51
+ schemas brittle.
52
+ - Pure post-hoc validation catches shape but not meaning.
53
+
54
+ Structural path:
55
+
56
+ - Use provider strict schema for short closed fields.
57
+ - Keep `evidence_refs` as string arrays in provider schema.
58
+ - Compute runtime allowed refs from prompt packet projections.
59
+ - Reject unsupported refs at submit time.
60
+ - Use a route where artifacts are created only by runtime submit handling.
61
+
62
+ Learning:
63
+
64
+ - Strict schema is real enforcement only where provider support and schema shape
65
+ are suitable.
66
+ - Long refs need runtime allowed-set validation.
67
+ - Each field needs one primary authority plus enough layered checks.
68
+
69
+ ## MCP-Projectable Schema Boundary
70
+
71
+ Problem:
72
+
73
+ - MCP/Claude tool surfaces need simple, directly valid object schemas.
74
+ - Internal artifact schemas may benefit from richer JSON Schema composition.
75
+ - Treating every repository schema as a tool schema can over-constrain internal
76
+ design, while exposing composed schemas can break tool hosts.
77
+
78
+ Structural path:
79
+
80
+ - Expose pattern-valid canonical tool names: use `namespace_verb` snake_case
81
+ such as `sheets_read`, matching `^[a-zA-Z0-9_-]{1,64}$`; reuse the catalog
82
+ name for dispatch, audit, and allowed-tool config, and enforce it in catalog
83
+ or seed validation.
84
+ - Treat MCP tool `input_schema` values and schemas intended for MCP/Claude tool
85
+ projection as MCP-projectable schemas.
86
+ - For MCP-projectable schemas, prefer direct object schemas with explicit
87
+ fields and avoid `oneOf`, `anyOf`, and `allOf`.
88
+ - Put variant behavior behind operation enums, deterministic dispatch, runtime
89
+ validation, or explicit projection adapters.
90
+ - Internal-only schemas may use composition when it materially reduces
91
+ complexity, but project them into compatible direct object schemas before
92
+ they reach an MCP/Claude tool surface.
93
+
94
+ Learning:
95
+
96
+ - The compatibility rule belongs at the tool projection boundary, not as a
97
+ universal ban on every internal schema.
98
+ - Tools/code should own projection and validation so the LLM cannot accidentally
99
+ expose an incompatible schema shape.
100
+
101
+ ## Issue Stance Matrix Projection
102
+
103
+ Problem:
104
+
105
+ - A compact projection lacked action and dependency context needed by later LLM
106
+ units.
107
+ - Asking later units to reread raw artifacts would increase latency and drift.
108
+
109
+ Structural path:
110
+
111
+ - Enrich the runtime projection with action, dependency, threshold, singleton,
112
+ shared-cause, and bounded-source-ref fields from authoritative upstream
113
+ artifacts.
114
+ - Keep matrix merge deterministic.
115
+ - Validate refs against allowed source variants.
116
+ - Track projection coverage and fallback when omitted context may matter.
117
+
118
+ Learning:
119
+
120
+ - Projection-first enrichment is often better than expanding LLM context.
121
+ - Add semantic context to deterministic projections when later judgment depends
122
+ on it.
123
+ - Projection quality needs coverage checks, not only schema checks.