Context
During the #11731 tenant-repo ingestion chain, four delegated Contract Ledger drafts (#11788, #11789, #11790, #11791) required verifier-side refinement before becoming issue-body source of truth. The repeated pattern was not that the six-column schema was missing; it was that rows naming existing surfaces drifted from current code/docs reality.
Observed corrections:
- #11789 draft used
sourceFiles; live KnowledgeBaseIngestionService.ingestSourceFiles() uses files, deleted, manifestSnapshot, baseRevision, and headRevision.
- #11790 draft reused
resolveDeploymentEnabled() for a cloud-deployable lane; live Orchestrator.mjs shows that helper is local-only shaped (cloud defaults disabled), so the new lane needs a cloud-deployable default contract.
- #11791 draft named the downstream MCP healthcheck tool instead of the substrate payload anchor; live Memory Core healthcheck surfaces orchestrator state under
healthcheck.orchestrator.tasks via HealthService.recordTaskOutcome().
- #11791 draft implied a
setTenantConfig MCP tool; live substrate has KnowledgeBaseIngestionService.setTenantConfig() but no such tool surface.
- #11791 draft assumed old backup scope rather than re-checking the #11788 mirror-volume posture.
Duplicate sweep: exact search over resources/content/issues, resources/content/discussions, learn/agentos, and .agents/skills found the general Contract Ledger protocol and V-B-A rules, but no ticket for row-level surface-anchor verification. Live gh issue list --search '"Contract Ledger" "Verify-Before-Assert" "surface"' returned no open duplicates. KB semantic search was attempted but failed with Internal error: Error finding id while KB healthcheck remained healthy.
The Problem
The current Contract Ledger protocol requires a canonical matrix, but it does not explicitly require each row that names an existing API/config/tool/helper/doc surface to first verify that surface's current literal name, shape, and owning substrate.
That leaves a repeatable failure mode: agents draft a semantically plausible row, the row passes schema review, but it encodes a stale field name, helper semantics inversion, downstream-consumer alias, nonexistent tool surface, or outdated scope assumption. The error is then caught during reviewer/operator refinement instead of upstream at ledger authoring time.
The Architectural Reality
Relevant current authorities:
learn/agentos/contract-ledger.md defines the Contract Ledger schema and lifecycle integration.
.agents/skills/ticket-create/references/ticket-create-workflow.md requires Contract Ledgers in new tickets when consumed surfaces are introduced or modified.
.agents/skills/ticket-intake/references/ticket-intake-workflow.md blocks implementation when the ledger is missing or incomplete.
.agents/skills/pr-review/references/pr-review-guide.md audits PR diffs against the ledger and rejects drift.
.agents/skills/create-skill/references/skill-authoring-guide.md says skill payload changes should preserve progressive disclosure; do not bloat routers or top-level SKILL.md files.
The missing discipline belongs at the Contract Ledger authoring layer, not as another global AGENTS.md rule. A compact section in learn/agentos/contract-ledger.md plus narrow workflow pointers is enough.
The Fix
Add a "surface-anchor V-B-A" rule for Contract Ledger authoring:
- For every ledger row that cites an existing code/doc/tool/config surface, run a falsifying lookup before naming it.
- Record or imply the anchor in the row's Source of Authority / Evidence cell.
- Prefer substrate names over downstream-consumer aliases.
- If a desired surface does not exist, phrase the row as "implementation may add" or "new surface to be introduced", not as current reality.
- Keep the detailed guidance in
learn/agentos/contract-ledger.md; add only compact pointers in ticket-create/ticket-intake/pr-review payloads if needed.
Contract Ledger Matrix
| Target Surface |
Source of Authority |
Proposed Behavior |
Fallback / Edge Case |
Docs |
Evidence |
learn/agentos/contract-ledger.md authoring guidance |
#11788-#11791 refinement cycle + AGENTS.md Verify-Before-Assert |
Add a row-level surface-anchor V-B-A subsection requiring empirical lookup for cited existing surfaces before naming fields, methods, helpers, tools, or docs. |
If the surface is intentionally new, row must say it is introduced by this work rather than current substrate. |
Yes |
Static grep confirms the section exists and includes examples for field name, helper semantics, consumer alias, nonexistent surface, and stale scope. |
ticket-create workflow pointer |
Existing Contract Ledger creation gate |
Add a compact pointer from the Contract Ledger bullet to the new surface-anchor V-B-A guidance; keep payload detail out of router/top-level skill. |
If payload budget is tight, link only to learn/agentos/contract-ledger.md. |
Yes |
rg shows pointer present; skill manifest lint if workflow payload changes require it. |
ticket-intake / pr-review audit wording |
Existing intake and review ledger gates |
Intake/review should check not only ledger presence, but whether rows naming existing surfaces cite or match current substrate. |
For old tickets, reviewers may request a ledger refresh instead of blocking on historical prose if implementation matches current reality. |
Yes |
Focused doc diff; no runtime tests unless a lint/check is added. |
Decision Record Impact
Aligned with the Verify-Before-Assert core value and the existing Contract Ledger protocol. No ADR amendment required; this is workflow/documentation hardening.
Acceptance Criteria
Out of Scope
- Creating a new skill.
- Adding runtime code or tests unless a mechanical lint/check is introduced during implementation.
- Rewriting existing Contract Ledgers retroactively beyond #11788-#11791, which are already corrected.
Avoided Traps
| Trap |
Why rejected |
Add another global rule to AGENTS.md |
The failure is specific to Contract Ledger authoring and review; always-loaded substrate is unnecessary. |
| Require line-number citations in every ledger row |
Useful when cheap, but too heavy as a universal rule; the key invariant is empirical anchoring before naming the surface. |
| Treat comments/A2A lessons as durable enough |
Mailbox memory helped this session, but future ledger authors need the discipline in the contract-authoring substrate. |
Related
- #11731 tenant-repo ingestion epic.
- #11788 / #11881 GitMirror primitive.
- #11789 diff-to-ingest envelope builder.
- #11790 tenant-repo-sync scheduler lane.
- #11791 operator docs + health/telemetry.
learn/agentos/contract-ledger.md.
Origin Session ID
967e325b-d90a-43f4-9e91-c212e9bda746
Handoff Retrieval Hints
query_raw_memories("#11789 #11790 #11791 Contract Ledger sourceFiles resolveDeploymentEnabled orchestrator.tasks setTenantConfig")
query_raw_memories("Contract Ledger surface-anchor V-B-A row authoring")
Context
During the #11731 tenant-repo ingestion chain, four delegated Contract Ledger drafts (#11788, #11789, #11790, #11791) required verifier-side refinement before becoming issue-body source of truth. The repeated pattern was not that the six-column schema was missing; it was that rows naming existing surfaces drifted from current code/docs reality.
Observed corrections:
sourceFiles; liveKnowledgeBaseIngestionService.ingestSourceFiles()usesfiles,deleted,manifestSnapshot,baseRevision, andheadRevision.resolveDeploymentEnabled()for a cloud-deployable lane; liveOrchestrator.mjsshows that helper is local-only shaped (clouddefaults disabled), so the new lane needs a cloud-deployable default contract.healthcheck.orchestrator.tasksviaHealthService.recordTaskOutcome().setTenantConfigMCP tool; live substrate hasKnowledgeBaseIngestionService.setTenantConfig()but no such tool surface.Duplicate sweep: exact search over
resources/content/issues,resources/content/discussions,learn/agentos, and.agents/skillsfound the general Contract Ledger protocol and V-B-A rules, but no ticket for row-level surface-anchor verification. Livegh issue list --search '"Contract Ledger" "Verify-Before-Assert" "surface"'returned no open duplicates. KB semantic search was attempted but failed withInternal error: Error finding idwhile KB healthcheck remained healthy.The Problem
The current Contract Ledger protocol requires a canonical matrix, but it does not explicitly require each row that names an existing API/config/tool/helper/doc surface to first verify that surface's current literal name, shape, and owning substrate.
That leaves a repeatable failure mode: agents draft a semantically plausible row, the row passes schema review, but it encodes a stale field name, helper semantics inversion, downstream-consumer alias, nonexistent tool surface, or outdated scope assumption. The error is then caught during reviewer/operator refinement instead of upstream at ledger authoring time.
The Architectural Reality
Relevant current authorities:
learn/agentos/contract-ledger.mddefines the Contract Ledger schema and lifecycle integration..agents/skills/ticket-create/references/ticket-create-workflow.mdrequires Contract Ledgers in new tickets when consumed surfaces are introduced or modified..agents/skills/ticket-intake/references/ticket-intake-workflow.mdblocks implementation when the ledger is missing or incomplete..agents/skills/pr-review/references/pr-review-guide.mdaudits PR diffs against the ledger and rejects drift..agents/skills/create-skill/references/skill-authoring-guide.mdsays skill payload changes should preserve progressive disclosure; do not bloat routers or top-levelSKILL.mdfiles.The missing discipline belongs at the Contract Ledger authoring layer, not as another global AGENTS.md rule. A compact section in
learn/agentos/contract-ledger.mdplus narrow workflow pointers is enough.The Fix
Add a "surface-anchor V-B-A" rule for Contract Ledger authoring:
learn/agentos/contract-ledger.md; add only compact pointers in ticket-create/ticket-intake/pr-review payloads if needed.Contract Ledger Matrix
learn/agentos/contract-ledger.mdauthoring guidanceticket-createworkflow pointerlearn/agentos/contract-ledger.md.rgshows pointer present; skill manifest lint if workflow payload changes require it.ticket-intake/pr-reviewaudit wordingDecision Record Impact
Aligned with the Verify-Before-Assert core value and the existing Contract Ledger protocol. No ADR amendment required; this is workflow/documentation hardening.
Acceptance Criteria
learn/agentos/contract-ledger.mddefines the row-level surface-anchor V-B-A rule.SKILL.mdrouters.AGENTS.mdexpansion unless implementation proves the payload pointer is insufficient.Out of Scope
Avoided Traps
AGENTS.mdRelated
learn/agentos/contract-ledger.md.Origin Session ID
967e325b-d90a-43f4-9e91-c212e9bda746Handoff Retrieval Hints
query_raw_memories("#11789 #11790 #11791 Contract Ledger sourceFiles resolveDeploymentEnabled orchestrator.tasks setTenantConfig")query_raw_memories("Contract Ledger surface-anchor V-B-A row authoring")