Context
Operator feedback on 2026-05-24 surfaced a direct regression after the why-first documentation contract landed: PR #11901 still introduced source comments that foregrounded ticket #11862 AC5 / AC4 instead of durable intent.
This is not a new documentation theory. #11890 / PR #11897 codified the forward rule, and learn/agentos/AGENTS_ATLAS.md now says living source comments should default away from ticket, PR, lane, AC, cycle, and line-number anchors. The gap is that ai/ already carries substantial documentation archaeology, and new reviews can still miss it.
Duplicate / adjacency sweep:
ask_knowledge_base(query='ai folder source comments ticket AC archaeology cleanup why-first documentation contract', type='ticket') failed with Internal error: Error finding id; exact sweeps below were used as fallback evidence.
- Local
rg across resources/content/issues, resources/content/discussions, .agents/skills, and learn/agentos surfaced #11890 as the forward contract, #11605 as skill-baggage compression, and #10341 as MCP OpenAPI description budget. None owns active ai/ source cleanup.
- Current-tree diagnostic:
rg -n "ticket #|#[0-9]{4,}|\bAC[0-9]+\b|\bAC [0-9]+\b|Lane [A-Z]|cycle-[0-9]|PR #[0-9]+|:[0-9]+-[0-9]+" ai --glob '*.mjs' returns 911 candidate lines.
- File inventory for the same diagnostic spans over 100
ai/**/*.mjs files, including Memory Core, GitHub Workflow sync, lifecycle scripts, Orchestrator services, and MCP server configs.
The Problem
The forward rule exists, but the living ai/ source still contains a large amount of ticket/PR/AC/cycle/line-number archaeology. That creates two costs:
- Source comments become stale narrative instead of durable maintenance guidance.
- Reviewers can accept new examples of the same pattern because the surrounding code normalizes it.
The desired direction remains one-way: tickets, PRs, commits, and Discussions may mention code because they are snapshot artifacts; source comments should explain durable intent, invariant, local boundary, or stable symbol.
src/core/Base.mjs is a useful style reference: its comments explain framework concepts and invariants in stable terms without pointing readers through closed ticket history.
The Architectural Reality
- #11890 / PR #11897 added the source-comment intent filter and diagnostic-first posture.
learn/agentos/AGENTS_ATLAS.md carries the compact authority: comments explain durable intent and default away from ticket/PR/lane/AC/cycle/line-number anchors.
- This ticket is the active cleanup that #11890 deliberately kept out of scope.
- The scope is
ai/**/*.mjs source comments and JSDoc first. Test titles, ticket bodies, PR bodies, generated resource mirrors, and historical ADR/discussion artifacts keep their existing archaeology rules.
The Fix
Perform a measured cleanup of ai/ source-comment archaeology.
- Build an inventory from the diagnostic command and classify candidates by marker type and false-positive class.
- Rewrite comments/JSDoc from ticket/AC/history phrasing into durable intent, stable symbols, and local ownership boundaries.
- Start with the PR #11901 scheduling/collector surface, then proceed by high-noise
ai/ subfolder batches.
- Move genuinely durable historical rationale to ADR / Atlas / learn / owning primitive docs only when it is still load-bearing; otherwise delete stale history rather than re-homing it.
- Keep the cleanup behavior-only: no runtime changes beyond comments unless a comment exposes a real code bug that needs a separate ticket.
Contract Ledger Matrix
| Target Surface |
Source of Authority |
Proposed Behavior |
Fallback |
Docs |
Evidence |
ai/**/*.mjs comments and JSDoc |
#11890 + AGENTS_ATLAS.md source-comment intent filter |
Living source explains durable intent, invariant, stable symbol, or local boundary |
If history is still needed, move it to a stable doc surface; source cites the stable symbol/surface, not the original ticket |
Existing Atlas rule |
Before/after diagnostic counts and reviewed file list |
| PR #11901 scheduling comments |
Operator regression report on 2026-05-24 |
Remove ticket #11862 AC* guardrail wording and express the invariant directly |
If the merged file has moved, clean the equivalent scheduling collector/picker surface on current dev |
PR body only |
Diff shows no ticket/AC anchors in changed source comments |
| Cleanup batching |
Current diagnostic returns 911 candidate lines |
Implement in focused batches with clear before/after counts |
If the full sweep is too large, file child tickets by ai/ subfolder and close only the first proven batch here |
Ticket/PR body |
Batch inventory + child links if needed |
| Allowed exceptions |
#11890 test-description carve-out |
Test descriptions may keep ticket/AC anchors when they are AC-verification artifacts; source comments remain strict |
False positives documented, not blindly removed |
PR body |
Candidate-classification table |
Decision Record Impact
Aligned with ADR 0005's separation of executable authority from archaeology trails and with ADR 0008 / Progressive Disclosure. No ADR amendment expected; this is cleanup under the already-graduated #11890 contract.
Acceptance Criteria
Out of Scope
- Hard CI enforcement for this pattern.
- Whole-repo cleanup outside
ai/.
- Rewriting tickets, PR bodies, Discussions, ADR archaeology, generated sync mirrors, or test titles covered by #11890's carve-out.
- Changing runtime behavior while editing comments.
Avoided Traps
| Trap |
Why rejected |
| Adding another broad rule or template section |
The rule already exists; this is cleanup and reviewer discipline, not more substrate. |
| Pure mechanical deletion |
Some comments carry real local invariants; rewrite to intent when the invariant is durable. |
| Preserving history by moving all of it elsewhere |
Most stale ticket/AC prose should simply disappear from living source. |
| Using this ticket number in replacement comments |
That would recreate the same anti-pattern. |
Related
- #11890 — forward why-first source-code documentation contract.
- PR #11897 — implementation of #11890.
- PR #11901 — immediate regression example cited by the operator.
- #11605 — adjacent skill-baggage compression program, not a duplicate.
- #10341 — adjacent MCP OpenAPI description budget, not a duplicate.
Origin Session ID: 967e325b-d90a-43f4-9e91-c212e9bda746
Handoff Retrieval Hint: query_raw_memories("ai source comments ticket AC archaeology cleanup why-first source-code documentation contract PR 11901")
Context
Operator feedback on 2026-05-24 surfaced a direct regression after the why-first documentation contract landed: PR #11901 still introduced source comments that foregrounded
ticket #11862 AC5/AC4instead of durable intent.This is not a new documentation theory. #11890 / PR #11897 codified the forward rule, and
learn/agentos/AGENTS_ATLAS.mdnow says living source comments should default away from ticket, PR, lane, AC, cycle, and line-number anchors. The gap is thatai/already carries substantial documentation archaeology, and new reviews can still miss it.Duplicate / adjacency sweep:
ask_knowledge_base(query='ai folder source comments ticket AC archaeology cleanup why-first documentation contract', type='ticket')failed withInternal error: Error finding id; exact sweeps below were used as fallback evidence.rgacrossresources/content/issues,resources/content/discussions,.agents/skills, andlearn/agentossurfaced #11890 as the forward contract, #11605 as skill-baggage compression, and #10341 as MCP OpenAPI description budget. None owns activeai/source cleanup.rg -n "ticket #|#[0-9]{4,}|\bAC[0-9]+\b|\bAC [0-9]+\b|Lane [A-Z]|cycle-[0-9]|PR #[0-9]+|:[0-9]+-[0-9]+" ai --glob '*.mjs'returns 911 candidate lines.ai/**/*.mjsfiles, including Memory Core, GitHub Workflow sync, lifecycle scripts, Orchestrator services, and MCP server configs.The Problem
The forward rule exists, but the living
ai/source still contains a large amount of ticket/PR/AC/cycle/line-number archaeology. That creates two costs:The desired direction remains one-way: tickets, PRs, commits, and Discussions may mention code because they are snapshot artifacts; source comments should explain durable intent, invariant, local boundary, or stable symbol.
src/core/Base.mjsis a useful style reference: its comments explain framework concepts and invariants in stable terms without pointing readers through closed ticket history.The Architectural Reality
learn/agentos/AGENTS_ATLAS.mdcarries the compact authority: comments explain durable intent and default away from ticket/PR/lane/AC/cycle/line-number anchors.ai/**/*.mjssource comments and JSDoc first. Test titles, ticket bodies, PR bodies, generated resource mirrors, and historical ADR/discussion artifacts keep their existing archaeology rules.The Fix
Perform a measured cleanup of
ai/source-comment archaeology.ai/subfolder batches.Contract Ledger Matrix
ai/**/*.mjscomments and JSDocAGENTS_ATLAS.mdsource-comment intent filterticket #11862 AC*guardrail wording and express the invariant directlydevai/subfolder and close only the first proven batch hereDecision Record Impact
Aligned with ADR 0005's separation of executable authority from archaeology trails and with ADR 0008 / Progressive Disclosure. No ADR amendment expected; this is cleanup under the already-graduated #11890 contract.
Acceptance Criteria
ai/**/*.mjssource-comment candidates with before counts, marker classes, and known false-positive classes.ticket #11862 AC*or equivalent snapshot anchors on currentdev.Base#ready()or owning files/classes where useful.ai/sweep is too large for one PR, file child cleanup tickets by subfolder before closing this ticket.git diff --checkand any relevant lint/test command for touched files; no runtime behavior changes are bundled.Out of Scope
ai/.Avoided Traps
Related
Origin Session ID: 967e325b-d90a-43f4-9e91-c212e9bda746
Handoff Retrieval Hint:
query_raw_memories("ai source comments ticket AC archaeology cleanup why-first source-code documentation contract PR 11901")