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.
- package/DEPENDENCIES.md +89 -0
- package/LICENSE +21 -0
- package/README.md +86 -0
- package/claude/CLAUDE.md +138 -0
- package/claude/guides/cli-multi-model-workflow.md +194 -0
- package/claude/guides/coding-staged-workflow.md +70 -0
- package/claude/guides/implementation-map.md +34 -0
- package/claude/guides/llm-capability-boundary-examples.md +123 -0
- package/claude/guides/llm-capability-boundary-patterns.md +339 -0
- package/claude/guides/llm-capability-boundary.md +255 -0
- package/claude/guides/mock-realization-boundary.md +275 -0
- package/claude/guides/svg-visualization-guide.md +321 -0
- package/codex/AGENTS.md +139 -0
- package/codex/agents/frontier.toml +8 -0
- package/codex/agents/reviewer.toml +9 -0
- package/codex/agents/sweep.toml +9 -0
- package/codex/agents/workhorse.toml +8 -0
- package/codex/guides/cli-multi-model-workflow.md +194 -0
- package/codex/guides/coding-staged-workflow.md +70 -0
- package/codex/guides/implementation-map.md +34 -0
- package/codex/guides/llm-capability-boundary-examples.md +123 -0
- package/codex/guides/llm-capability-boundary-patterns.md +339 -0
- package/codex/guides/llm-capability-boundary.md +255 -0
- package/codex/guides/mock-realization-boundary.md +275 -0
- package/codex/guides/svg-visualization-guide.md +321 -0
- package/config/agent-launch.toml +94 -0
- package/package.json +54 -0
- package/scripts/agent-launch.py +1742 -0
- package/scripts/check-parity.sh +1703 -0
- package/scripts/codex-helm.sh +370 -0
- package/scripts/codex-run.sh +176 -0
- package/scripts/install.sh +310 -0
- package/scripts/provision-venv.sh +28 -0
- package/scripts/session-cost.py +106 -0
- package/shell/agent-launch.zsh +38 -0
|
@@ -0,0 +1,255 @@
|
|
|
1
|
+
---
|
|
2
|
+
guide_id: llm-capability-boundary
|
|
3
|
+
language: en
|
|
4
|
+
status: active
|
|
5
|
+
use_when:
|
|
6
|
+
- designing structured outputs
|
|
7
|
+
- changing runtime-owned artifacts
|
|
8
|
+
- defining submit tools or accepted output channels
|
|
9
|
+
- separating LLM semantic judgment from deterministic execution
|
|
10
|
+
- designing validators, grounding checks, or capability-surface constraints
|
|
11
|
+
- designing tool use, retrieval, side effects, or artifact persistence
|
|
12
|
+
core_rules:
|
|
13
|
+
- instructions describe intended work, semantic criteria, and completion criteria
|
|
14
|
+
- capability surface enforces constraints through context, tools, permissions, routes, paths, output channels, validators, gates, and approvals
|
|
15
|
+
- assign each field or operation one primary authority, then add layered checks where needed
|
|
16
|
+
- LLM handles semantic judgment, rationale, tradeoffs, and evidence reduction
|
|
17
|
+
- runtime/tools handle deterministic execution, artifact creation, merge, serialization, validation, persistence, and tests
|
|
18
|
+
- machine-consumed artifacts are created through submit tools or equivalent constrained channels
|
|
19
|
+
- provider strict schema is an execution aid, not the source of artifact truth
|
|
20
|
+
- tool inputs, tool results, retrieved content, and rendered views are untrusted until validated or sanitized
|
|
21
|
+
field_assignment:
|
|
22
|
+
short_closed_values: provider_closed_selection_plus_runtime_enum_validation
|
|
23
|
+
runtime_known_ids: runtime_owned_unless_selection_is_semantic
|
|
24
|
+
long_refs_and_source_snippets: runtime_allowed_set_validation
|
|
25
|
+
evidence_anchors: grounding_blocked_when_source_truth_is_decidable
|
|
26
|
+
source_provenance: runtime_owned_snapshot_hash_scope_and_trust_tier
|
|
27
|
+
open_rationale: free_generation_with_shape_checks
|
|
28
|
+
side_effects: capability_surface_plus_policy_gate
|
|
29
|
+
artifact_envelope_and_serialization: runtime_only
|
|
30
|
+
verification_focus:
|
|
31
|
+
- accepted output channel is explicit
|
|
32
|
+
- LLM cannot create canonical machine artifacts through free prose
|
|
33
|
+
- runtime-owned fields and unknown fields fail loudly
|
|
34
|
+
- provider schema limits are known and probed before relying on them
|
|
35
|
+
- long refs are validated by runtime allowed sets instead of provider enums
|
|
36
|
+
- grounding gates are used only for decidable truths
|
|
37
|
+
- source trust, permission, staleness, and poisoning risk are checked separately from quote grounding
|
|
38
|
+
- side-effect tools are classified by risk and gated by permission or approval
|
|
39
|
+
- artifact writes are atomic, idempotent where possible, and auditable
|
|
40
|
+
- schema, validator, allowed-set, prompt, and tests share one authority or have drift-catching tests
|
|
41
|
+
---
|
|
42
|
+
|
|
43
|
+
# LLM And Capability Boundary Guide
|
|
44
|
+
|
|
45
|
+
Use this guide when an LLM produces, selects, validates, summarizes, or routes
|
|
46
|
+
machine-consumed artifacts, code, ontology, pipeline outputs, review findings,
|
|
47
|
+
structured documents, or runtime decisions.
|
|
48
|
+
|
|
49
|
+
The core lesson is simple: instructions describe the intended work; the
|
|
50
|
+
capability surface makes the valid execution path available, bounded, accepted,
|
|
51
|
+
and observable.
|
|
52
|
+
|
|
53
|
+
Scoped extensions:
|
|
54
|
+
|
|
55
|
+
- For enforcement mechanics — submit tools, runtime-owned fields, output
|
|
56
|
+
channel locks, provider schema use, allowed-set validation, grounding and
|
|
57
|
+
provenance, deterministic projection, security and side effects,
|
|
58
|
+
persistence and retry, and schema evolution — read and use
|
|
59
|
+
`${CLAUDE_CONFIG_DIR:-$HOME/.claude}/guides/llm-capability-boundary-patterns.md`.
|
|
60
|
+
- For worked case studies applying this boundary, read and use
|
|
61
|
+
`${CLAUDE_CONFIG_DIR:-$HOME/.claude}/guides/llm-capability-boundary-examples.md`.
|
|
62
|
+
|
|
63
|
+
## Core Model
|
|
64
|
+
|
|
65
|
+
- Instructions describe intended work, semantic criteria, tradeoffs, and
|
|
66
|
+
completion criteria.
|
|
67
|
+
- The LLM performs semantic work: intent clarification, meaning assignment,
|
|
68
|
+
materiality and causality judgment, rationale writing, option comparison,
|
|
69
|
+
and evidence reduction.
|
|
70
|
+
- Runtime/tools perform authoritative mechanical work: parsing, counting,
|
|
71
|
+
calculation, API calls, deterministic merge, serialization, validation,
|
|
72
|
+
persistence, tests, and diff comparison.
|
|
73
|
+
- The capability surface provides structural constraints: accessible context,
|
|
74
|
+
available tools, permissions, execution routes, artifact paths, accepted output
|
|
75
|
+
channels, validators, retry policy, approval gates, and failure behavior.
|
|
76
|
+
- Canonical artifacts are created by runtime/tools, not by raw LLM prose, when
|
|
77
|
+
downstream systems consume them.
|
|
78
|
+
|
|
79
|
+
Prefer this framing:
|
|
80
|
+
|
|
81
|
+
> The LLM may propose semantic content. The runtime decides what becomes
|
|
82
|
+
> artifact truth.
|
|
83
|
+
|
|
84
|
+
Use stronger prompts to clarify meaning. Use capability design to constrain
|
|
85
|
+
behavior that affects correctness, reproducibility, artifact truth, privacy,
|
|
86
|
+
security, or side effects.
|
|
87
|
+
|
|
88
|
+
## Capability Surface
|
|
89
|
+
|
|
90
|
+
The capability surface is the set of actions the LLM can actually take and the
|
|
91
|
+
outputs the runtime will actually accept. Shape it before relying on the LLM to
|
|
92
|
+
follow a rule.
|
|
93
|
+
|
|
94
|
+
Important levers:
|
|
95
|
+
|
|
96
|
+
- Accessible context: files, refs, rows, artifacts, source snippets, projections,
|
|
97
|
+
and retrieved evidence the unit may inspect.
|
|
98
|
+
- Available tools: read tools, submit tools, validation tools, search tools, API
|
|
99
|
+
tools, renderers, and their input schemas.
|
|
100
|
+
- Permissions: read-only, workspace-write, denied paths, network access,
|
|
101
|
+
sandbox mode, route-specific side effects, and user approval.
|
|
102
|
+
- Execution routes: tool-capable executor, text-only executor, structured output
|
|
103
|
+
route, direct-call route, deterministic runtime route, or human-review route.
|
|
104
|
+
- Artifact paths: exact output paths, canonical truth locations, temp paths,
|
|
105
|
+
and denied write locations.
|
|
106
|
+
- Accepted output channels: submit tool call, structured JSON payload, runtime
|
|
107
|
+
projection, generated YAML, markdown view, or final prose.
|
|
108
|
+
- Validators and gates: schema validation, unknown-field rejection,
|
|
109
|
+
runtime-owned-field rejection, enum validation, allowed-set validation,
|
|
110
|
+
grounding checks, provenance checks, citation checks, static checks, E2E
|
|
111
|
+
checks, and semantic quality gates.
|
|
112
|
+
- Retry/fail policy: retry transient generation failures; fail clearly when the
|
|
113
|
+
available route cannot enforce the required contract.
|
|
114
|
+
- Observability: prompt packet snapshot, model/provider version, schema hash,
|
|
115
|
+
source snapshot, validator decision, retry reason, and artifact lineage.
|
|
116
|
+
|
|
117
|
+
## Boundary Decision Table
|
|
118
|
+
|
|
119
|
+
| Need | Primary authority | Preferred mechanism |
|
|
120
|
+
|---|---|---|
|
|
121
|
+
| Clarify user intent or product meaning | LLM | Prose reasoning and decision framing |
|
|
122
|
+
| Choose tradeoffs or materiality | LLM | Bounded semantic judgment with evidence |
|
|
123
|
+
| Produce open rationale or explanation | LLM | Free generation with shape constraints when needed |
|
|
124
|
+
| Inspect files or fresh facts | Tools/runtime | Search, parse, read, API call, source snapshot |
|
|
125
|
+
| Create canonical machine artifact | Runtime | Submit payload plus runtime serialization |
|
|
126
|
+
| Assign ids, paths, metadata, timestamps | Runtime | Runtime-owned fields |
|
|
127
|
+
| Merge artifacts by explicit rule | Runtime | Deterministic projection or merge |
|
|
128
|
+
| Validate syntax, schema, refs, counts | Runtime | Parser, schema, allowed-set, tests |
|
|
129
|
+
| Check source-span truth | Runtime | Grounding gate when decidable |
|
|
130
|
+
| Judge source trust or completeness | Runtime plus policy | Provenance, permission, staleness, trust tier |
|
|
131
|
+
| Prevent forbidden action | Capability surface | Make it unavailable, invalid, or unaccepted |
|
|
132
|
+
| Perform side effect | Capability surface plus policy | Risk class, permission, approval, audit log |
|
|
133
|
+
| Structured output required | Capability surface plus runtime | Submit tool or equivalent constrained channel |
|
|
134
|
+
|
|
135
|
+
## Structured Output Field Assignment
|
|
136
|
+
|
|
137
|
+
For each artifact field, assign one primary authority. Add layered checks for
|
|
138
|
+
cross-field invariants, security policy, privacy policy, and artifact-level
|
|
139
|
+
consistency.
|
|
140
|
+
|
|
141
|
+
| Field kind | Primary mechanism |
|
|
142
|
+
|---|---|
|
|
143
|
+
| Short closed values | Provider closed selection plus runtime enum validation |
|
|
144
|
+
| Runtime-known ids | Runtime-owned; provider enum only when LLM must select |
|
|
145
|
+
| Long refs and source snippets | Runtime closed validation; provider enum excluded |
|
|
146
|
+
| Evidence anchors | Grounding-blocked when source truth is decidable |
|
|
147
|
+
| Source provenance | Runtime-owned snapshot, hash, scope, trust tier, staleness |
|
|
148
|
+
| Open materiality or causal rationale | Free generation with structured shape checks |
|
|
149
|
+
| Side-effect decision | Capability surface plus policy and approval gate |
|
|
150
|
+
| Artifact envelope and serialization | Runtime only |
|
|
151
|
+
|
|
152
|
+
The goal is not to force every field into provider strict schema. The goal is
|
|
153
|
+
to use the weakest mechanism that is strong enough for that field.
|
|
154
|
+
|
|
155
|
+
## Generate-And-Validate
|
|
156
|
+
|
|
157
|
+
Generate-and-validate means the LLM generates a payload through one accepted
|
|
158
|
+
output channel, and runtime validates after generation.
|
|
159
|
+
|
|
160
|
+
It is useful when:
|
|
161
|
+
|
|
162
|
+
- fields are open and expressive
|
|
163
|
+
- iteration speed matters
|
|
164
|
+
- shape correctness is enough for the current step
|
|
165
|
+
- validator failures can be retried safely
|
|
166
|
+
|
|
167
|
+
It guarantees:
|
|
168
|
+
|
|
169
|
+
- expected top-level shape
|
|
170
|
+
- absence of unknown fields
|
|
171
|
+
- absence of runtime-owned fields
|
|
172
|
+
- parseable structured payload
|
|
173
|
+
- canonical artifact written by runtime
|
|
174
|
+
|
|
175
|
+
It does not guarantee meaning by itself. A well-formed payload can still contain
|
|
176
|
+
an unsupported claim, wrong ref, stale source, unauthorized source, unsafe link,
|
|
177
|
+
or semantically wrong category unless a validator or review gate catches it.
|
|
178
|
+
|
|
179
|
+
## Construct-And-Verify
|
|
180
|
+
|
|
181
|
+
Construct-and-verify means the runtime owns artifact construction, provides
|
|
182
|
+
closed choices where possible, and verifies grounded claims.
|
|
183
|
+
|
|
184
|
+
It is useful when:
|
|
185
|
+
|
|
186
|
+
- options can be enumerated before the LLM call
|
|
187
|
+
- refs or anchors can be checked against source truth
|
|
188
|
+
- invalid values must be impossible or fail-loud
|
|
189
|
+
- artifact authority or downstream impact is high
|
|
190
|
+
- side effects require permission, preview, or approval
|
|
191
|
+
|
|
192
|
+
It costs more:
|
|
193
|
+
|
|
194
|
+
- runtime must enumerate option space
|
|
195
|
+
- validators become product-critical code
|
|
196
|
+
- false constraints can exclude the right answer
|
|
197
|
+
- nuanced judgments can be discretized into the nearest bucket
|
|
198
|
+
- dependencies become more sequential
|
|
199
|
+
|
|
200
|
+
Use it per field or operation, not as a blanket replacement for LLM judgment.
|
|
201
|
+
|
|
202
|
+
## Design Procedure
|
|
203
|
+
|
|
204
|
+
Use this procedure when designing a new LLM-assisted artifact or revising an
|
|
205
|
+
existing one.
|
|
206
|
+
|
|
207
|
+
1. Identify the canonical artifact and downstream consumers.
|
|
208
|
+
2. Split fields into semantic fields, deterministic fields, provenance fields,
|
|
209
|
+
and side-effect operations.
|
|
210
|
+
3. Assign each field or operation one primary authority.
|
|
211
|
+
4. Decide the accepted output channel.
|
|
212
|
+
5. Shape accessible context and available tools around the task.
|
|
213
|
+
6. Make deterministic fields runtime-owned.
|
|
214
|
+
7. Decide which provider schema constraints are actually supported for the
|
|
215
|
+
selected model and route.
|
|
216
|
+
8. Derive schemas and validators from one canonical source.
|
|
217
|
+
9. Add fail-loud checks for unknown fields, runtime-owned fields, unsupported
|
|
218
|
+
refs, and denied actions.
|
|
219
|
+
10. Add grounding checks only where truth is decidable.
|
|
220
|
+
11. Add provenance checks for source trust, permission, freshness, and integrity.
|
|
221
|
+
12. Decide retry/fail policy by failure kind and side-effect class.
|
|
222
|
+
13. Make artifact persistence atomic and auditable.
|
|
223
|
+
14. Add focused tests for invalid values, unsupported refs, route rejection,
|
|
224
|
+
grounding failure, policy failure, schema drift, and artifact persistence.
|
|
225
|
+
15. Report which checks prove shape, which prove wiring, which prove source
|
|
226
|
+
grounding, and which only estimate semantic quality.
|
|
227
|
+
|
|
228
|
+
## Verification Checklist
|
|
229
|
+
|
|
230
|
+
- The LLM cannot create the canonical machine artifact through free prose.
|
|
231
|
+
- The accepted output channel is explicit.
|
|
232
|
+
- Structured output uses a submit tool or equivalent constrained channel.
|
|
233
|
+
- Runtime-owned fields are rejected if submitted by the LLM.
|
|
234
|
+
- Unknown fields fail loudly.
|
|
235
|
+
- Short closed values are provider enums where supported and runtime enums
|
|
236
|
+
everywhere.
|
|
237
|
+
- Provider schema limits and refusal/incomplete behavior are tested for the
|
|
238
|
+
selected route.
|
|
239
|
+
- Long refs are not provider enums when they are quote-heavy, private,
|
|
240
|
+
tenant-scoped, or source-derived.
|
|
241
|
+
- Runtime allowed-set checks reject unsupported refs.
|
|
242
|
+
- Grounding gates are used only for decidable truths.
|
|
243
|
+
- Source trust, permission, freshness, and integrity are checked separately from
|
|
244
|
+
source-span grounding.
|
|
245
|
+
- Tool inputs, tool results, retrieved content, LLM output, and rendered views
|
|
246
|
+
are treated as untrusted at each boundary.
|
|
247
|
+
- Side-effect tools have risk classes, permissions, and approval gates.
|
|
248
|
+
- Human views are derived from machine artifacts when possible and sanitized
|
|
249
|
+
before rendering.
|
|
250
|
+
- Artifact writes are atomic or have a clear recovery path.
|
|
251
|
+
- Retries are safe, idempotent, or explicitly blocked for the failure class.
|
|
252
|
+
- Schema, validator, allowed-set, prompt, and tests share one authority or have
|
|
253
|
+
drift-catching tests.
|
|
254
|
+
- Observability captures prompt packet, model/provider version, schema hash,
|
|
255
|
+
source snapshot, validator decision, retry reason, and artifact lineage.
|
|
@@ -0,0 +1,275 @@
|
|
|
1
|
+
---
|
|
2
|
+
guide_id: mock-realization-boundary
|
|
3
|
+
language: en
|
|
4
|
+
status: active
|
|
5
|
+
use_when:
|
|
6
|
+
- adding mocks, fakes, stubs, fixtures, or simulated providers
|
|
7
|
+
- deciding whether a mock-backed path counts as completion
|
|
8
|
+
- separating verification harnesses from production semantic paths
|
|
9
|
+
- centralizing mock payloads for later deletion or replacement
|
|
10
|
+
- reporting verification results that include mock-backed checks
|
|
11
|
+
core_rules:
|
|
12
|
+
- mocks are verification realizations, not production semantic paths
|
|
13
|
+
- use mocks to verify wiring, schemas, artifact contracts, deterministic projections, failure handling, and harness stability
|
|
14
|
+
- use real semantic paths to verify product behavior, materiality judgment, causal reasoning, and semantic quality
|
|
15
|
+
- keep mock behavior behind explicit realization switches, fixture modules, or mock executors
|
|
16
|
+
- centralize mock payloads in a small deletion boundary so mock support can be removed or replaced together
|
|
17
|
+
- share validators and artifact contracts between mock and production paths
|
|
18
|
+
- report mock-backed verification separately from production-path verification
|
|
19
|
+
completion_policy:
|
|
20
|
+
mock_backed_paths_support_verification: true
|
|
21
|
+
mock_backed_paths_count_as_product_completion: false
|
|
22
|
+
semantic_quality_from_mock: not_applicable
|
|
23
|
+
verification_focus:
|
|
24
|
+
- mock paths exercise the same artifact contracts as production paths
|
|
25
|
+
- mock payloads are centralized and easy to delete
|
|
26
|
+
- mock execution is selected only through explicit realization config
|
|
27
|
+
- verification reports distinguish mock, fixture, and live paths
|
|
28
|
+
- production semantic gates run on real semantic paths
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
# Mock Realization Boundary Guide
|
|
32
|
+
|
|
33
|
+
This guide is a scoped extension of the global Coding Guidelines. Use it when
|
|
34
|
+
adding, reviewing, or cleaning up mocks, fakes, stubs, fixtures, simulated
|
|
35
|
+
providers, or mock executors.
|
|
36
|
+
|
|
37
|
+
The central rule is that a mock is a verification realization. It can prove that
|
|
38
|
+
the harness, contract, validator, projection, or failure path works. It does not
|
|
39
|
+
prove that the product semantic path works.
|
|
40
|
+
|
|
41
|
+
## Core Distinction
|
|
42
|
+
|
|
43
|
+
| Question | Mock path | Production semantic path |
|
|
44
|
+
|---|---|---|
|
|
45
|
+
| What does it prove? | Wiring, schemas, persistence, projections, failures | Real behavior, semantic judgment, user-visible quality |
|
|
46
|
+
| Who owns semantics? | Fixture author | Real model, real service, real user input, or real runtime authority |
|
|
47
|
+
| Completion credit | Verification support only | Product completion evidence |
|
|
48
|
+
| Quality gate status | `not_applicable` or harness-only | Passed/failed against real semantic criteria |
|
|
49
|
+
| Cleanup strategy | Central deletion boundary | Maintained product path |
|
|
50
|
+
|
|
51
|
+
Use the same artifact contracts and validators whenever possible. The mock path
|
|
52
|
+
should exercise the product contract, not create a parallel contract.
|
|
53
|
+
|
|
54
|
+
## Appropriate Mock Uses
|
|
55
|
+
|
|
56
|
+
Use mocks for:
|
|
57
|
+
|
|
58
|
+
- wiring checks
|
|
59
|
+
- schema and parser checks
|
|
60
|
+
- artifact persistence checks
|
|
61
|
+
- deterministic projection checks
|
|
62
|
+
- retry and failure handling checks
|
|
63
|
+
- timeout and cancellation checks
|
|
64
|
+
- E2E harness stability
|
|
65
|
+
- fixture-based regression tests
|
|
66
|
+
- external dependency isolation when the dependency is not under test
|
|
67
|
+
|
|
68
|
+
Use real paths for:
|
|
69
|
+
|
|
70
|
+
- product behavior
|
|
71
|
+
- materiality judgment
|
|
72
|
+
- causal reasoning
|
|
73
|
+
- semantic quality gates
|
|
74
|
+
- user-visible recommendations
|
|
75
|
+
- provider integration confidence
|
|
76
|
+
- release evidence for high-risk flows
|
|
77
|
+
|
|
78
|
+
## Structural Pattern
|
|
79
|
+
|
|
80
|
+
1. Define an explicit realization selector such as `mock`, `fixture`, `live`, or
|
|
81
|
+
`direct`.
|
|
82
|
+
2. Keep mock payloads in a fixture module or fixture directory.
|
|
83
|
+
3. Keep mock executors as thin shells that route fixture payloads through the
|
|
84
|
+
same validators and artifact writers used by production.
|
|
85
|
+
4. Mark semantic-quality evaluation as `not_applicable` for mock realization.
|
|
86
|
+
5. Report mock-backed verification separately from live or production-path
|
|
87
|
+
verification.
|
|
88
|
+
6. Keep the deletion boundary small enough that mock support can be removed or
|
|
89
|
+
replaced in one focused change.
|
|
90
|
+
|
|
91
|
+
## Realization Selector
|
|
92
|
+
|
|
93
|
+
Use explicit realization config so a mock cannot silently become the product
|
|
94
|
+
path.
|
|
95
|
+
|
|
96
|
+
Illustrative implementation:
|
|
97
|
+
|
|
98
|
+
```ts
|
|
99
|
+
type Realization = "mock" | "fixture" | "live";
|
|
100
|
+
|
|
101
|
+
function parseRealization(value: string | undefined): Realization {
|
|
102
|
+
if (value === "mock" || value === "fixture" || value === "live") return value;
|
|
103
|
+
return "live";
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
function selectProvider(realization: Realization) {
|
|
107
|
+
if (realization === "mock") return createMockProvider();
|
|
108
|
+
if (realization === "fixture") return createFixtureProvider();
|
|
109
|
+
return createLiveProvider();
|
|
110
|
+
}
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
## Central Fixture Boundary
|
|
114
|
+
|
|
115
|
+
Centralize mock payloads. Runtime code that needs deterministic mock artifacts
|
|
116
|
+
imports from this boundary instead of growing inline mock-specific payloads.
|
|
117
|
+
|
|
118
|
+
Illustrative implementation:
|
|
119
|
+
|
|
120
|
+
```ts
|
|
121
|
+
export const reviewMockFixtures = {
|
|
122
|
+
findingLedger() {
|
|
123
|
+
return {
|
|
124
|
+
schema_version: 1,
|
|
125
|
+
findings: [
|
|
126
|
+
{
|
|
127
|
+
finding_id: "finding-001",
|
|
128
|
+
target: "fixture-target",
|
|
129
|
+
claim: "fixture finding",
|
|
130
|
+
severity: "low",
|
|
131
|
+
},
|
|
132
|
+
],
|
|
133
|
+
};
|
|
134
|
+
},
|
|
135
|
+
};
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
## Thin Mock Executor
|
|
139
|
+
|
|
140
|
+
Keep the mock executor as an execution shell. It should not become the place
|
|
141
|
+
where product behavior is reimplemented.
|
|
142
|
+
|
|
143
|
+
Illustrative implementation:
|
|
144
|
+
|
|
145
|
+
```ts
|
|
146
|
+
async function runMockUnit(unit: Unit, ctx: RuntimeContext) {
|
|
147
|
+
const payload = reviewMockFixtures[unit.artifactKind]();
|
|
148
|
+
const artifact = validateArtifact(payload, unit.artifactKind);
|
|
149
|
+
await writeArtifact(ctx.outputPath, artifact);
|
|
150
|
+
return {
|
|
151
|
+
realization: "mock",
|
|
152
|
+
artifact_path: ctx.outputPath,
|
|
153
|
+
semantic_quality: "not_applicable",
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
## Shared Validators
|
|
159
|
+
|
|
160
|
+
The mock path should pass through the same validators as production. This makes
|
|
161
|
+
mock tests useful for contract drift without letting mocks become product
|
|
162
|
+
completion evidence.
|
|
163
|
+
|
|
164
|
+
Illustrative implementation:
|
|
165
|
+
|
|
166
|
+
```ts
|
|
167
|
+
function writeArtifact(path: string, payload: unknown) {
|
|
168
|
+
const validated = validateCurrentArtifactContract(payload);
|
|
169
|
+
return writeYaml(path, validated);
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
await writeArtifact(outputPath, reviewMockFixtures.findingLedger());
|
|
173
|
+
await writeArtifact(outputPath, liveModelArtifact);
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
## Semantic Quality Gate
|
|
177
|
+
|
|
178
|
+
Mock-backed runs should make semantic quality explicitly not applicable. They
|
|
179
|
+
can still verify the harness and artifact collection.
|
|
180
|
+
|
|
181
|
+
Illustrative implementation:
|
|
182
|
+
|
|
183
|
+
```ts
|
|
184
|
+
function evaluateSemanticQuality(args: {
|
|
185
|
+
realization: Realization;
|
|
186
|
+
artifact: unknown;
|
|
187
|
+
}) {
|
|
188
|
+
if (args.realization === "mock") {
|
|
189
|
+
return {
|
|
190
|
+
status: "not_applicable",
|
|
191
|
+
applicability: "real_semantic_path_only",
|
|
192
|
+
reason: "mock verifies harness and contracts, not product semantics",
|
|
193
|
+
};
|
|
194
|
+
}
|
|
195
|
+
return evaluateLiveSemanticQuality(args.artifact);
|
|
196
|
+
}
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
## Verification Reporting
|
|
200
|
+
|
|
201
|
+
Separate mock-backed checks from production-path checks in final reports.
|
|
202
|
+
|
|
203
|
+
Preferred reporting shape:
|
|
204
|
+
|
|
205
|
+
```ts
|
|
206
|
+
type VerificationReport = {
|
|
207
|
+
mock_checks: CheckResult[];
|
|
208
|
+
fixture_checks: CheckResult[];
|
|
209
|
+
production_path_checks: CheckResult[];
|
|
210
|
+
unverified_risks: string[];
|
|
211
|
+
};
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
Useful report language:
|
|
215
|
+
|
|
216
|
+
- "Mock run passed artifact-contract checks."
|
|
217
|
+
- "Mock run did not evaluate product semantic quality."
|
|
218
|
+
- "Live semantic path remains unverified."
|
|
219
|
+
- "Production path passed semantic quality gate."
|
|
220
|
+
|
|
221
|
+
## Deletion Boundary
|
|
222
|
+
|
|
223
|
+
Mock support should be easy to remove or replace. A good deletion boundary has:
|
|
224
|
+
|
|
225
|
+
- one fixture module or fixture directory
|
|
226
|
+
- one realization selector
|
|
227
|
+
- one mock executor shell if needed
|
|
228
|
+
- shared validators outside the mock boundary
|
|
229
|
+
- tests that name the realization explicitly
|
|
230
|
+
- no product runtime dependency on mock-only payloads
|
|
231
|
+
|
|
232
|
+
When cleanup is needed, remove or replace the fixture module, realization route,
|
|
233
|
+
and mock-only tests together.
|
|
234
|
+
|
|
235
|
+
## Product Completion Rule
|
|
236
|
+
|
|
237
|
+
Mock-backed paths can support verification but do not count as product
|
|
238
|
+
completion.
|
|
239
|
+
|
|
240
|
+
Examples:
|
|
241
|
+
|
|
242
|
+
- A mock E2E can prove the pipeline writes all expected artifacts.
|
|
243
|
+
- A mock E2E cannot prove the recommendation is semantically correct.
|
|
244
|
+
- A fixture can prove a validator rejects malformed payloads.
|
|
245
|
+
- A fixture cannot prove a live provider follows the intended reasoning path.
|
|
246
|
+
- A mock provider can prove retry handling.
|
|
247
|
+
- A mock provider cannot prove the real provider integration is production-ready.
|
|
248
|
+
|
|
249
|
+
## Design Procedure
|
|
250
|
+
|
|
251
|
+
Use this procedure before adding or extending mock behavior.
|
|
252
|
+
|
|
253
|
+
1. Name what the mock is meant to verify.
|
|
254
|
+
2. Name what the mock does not verify.
|
|
255
|
+
3. Choose an explicit realization selector.
|
|
256
|
+
4. Put mock payloads in one fixture boundary.
|
|
257
|
+
5. Route mock outputs through shared validators and artifact writers.
|
|
258
|
+
6. Keep mock executors thin.
|
|
259
|
+
7. Mark semantic quality as not applicable for mock runs.
|
|
260
|
+
8. Add reporting that separates mock checks from production-path checks.
|
|
261
|
+
9. Add at least one real semantic-path check when product behavior is part of
|
|
262
|
+
the completion claim.
|
|
263
|
+
10. Keep deletion or replacement possible in one focused change.
|
|
264
|
+
|
|
265
|
+
## Verification Checklist
|
|
266
|
+
|
|
267
|
+
- Mock use is explicitly selected.
|
|
268
|
+
- Mock payloads are centralized.
|
|
269
|
+
- Mock behavior is not embedded across production logic.
|
|
270
|
+
- Mock output uses the current production artifact contract.
|
|
271
|
+
- Shared validators run on mock output.
|
|
272
|
+
- Mock-backed verification is reported separately.
|
|
273
|
+
- Semantic quality is not claimed from mock-backed output.
|
|
274
|
+
- Product completion has real semantic-path evidence.
|
|
275
|
+
- Mock support has a clear deletion boundary.
|