LearnNewsExamplesServices
Frontmatter
id11912
titleClean ai source-comment archaeology
stateClosed
labels
documentationepicairefactoringarchitecturemodel-experience
assigneesneo-gpt
createdAtMay 24, 2026, 4:31 PM
updatedAtJun 2, 2026, 11:06 PM
githubUrlhttps://github.com/neomjs/neo/issues/11912
authorneo-gpt
commentsCount5
parentIssuenull
subIssues
11923 Clean KB and graph source-comment archaeology
11922 Clean Memory Core source-comment archaeology
11924 Clean GitHub Workflow and shared MCP source comments
11925 Clean daemon script and config source comments
subIssuesCompleted4
subIssuesTotal4
blockedBy[]
blocking[]
closedAtJun 2, 2026, 11:06 PM

Clean ai source-comment archaeology

Closed v13.0.0/archive-v13-0-0-chunk-13 documentationepicairefactoringarchitecturemodel-experience
neo-gpt
neo-gpt commented on May 24, 2026, 4:31 PM

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:

  1. Source comments become stale narrative instead of durable maintenance guidance.
  2. 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.

  1. Build an inventory from the diagnostic command and classify candidates by marker type and false-positive class.
  2. Rewrite comments/JSDoc from ticket/AC/history phrasing into durable intent, stable symbols, and local ownership boundaries.
  3. Start with the PR #11901 scheduling/collector surface, then proceed by high-noise ai/ subfolder batches.
  4. 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.
  5. 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

  • Inventory ai/**/*.mjs source-comment candidates with before counts, marker classes, and known false-positive classes.
  • Clean the PR #11901 scheduling/collector comments that cite ticket #11862 AC* or equivalent snapshot anchors on current dev.
  • Rewrite changed comments to durable intent, stable symbols, and local boundaries; do not replace ticket archaeology with another ticket reference.
  • Remove line-number references from changed source comments; use stable symbols such as Base#ready() or owning files/classes where useful.
  • Avoid re-explaining generic Neo primitives in every consumer; point to owning primitive docs only when a pointer is needed.
  • Provide before/after diagnostic counts for the cleaned batch and list any explicit false positives left untouched.
  • If the full ai/ sweep is too large for one PR, file child cleanup tickets by subfolder before closing this ticket.
  • Validation includes git diff --check and any relevant lint/test command for touched files; no runtime behavior changes are bundled.

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")

tobiu referenced in commit c074838 - "docs(ai): clean orchestrator source-comment archaeology (#11912) (#11914) on May 24, 2026, 6:08 PM
tobiu referenced in commit 5baf2e1 - "chore(ai): clean maintenance comment archaeology (#11912) (#11916) on May 24, 2026, 6:45 PM
tobiu referenced in commit ddcd0d2 - "docs(ai): clean lifecycle and orchestrator comment archaeology (#11912) (#11917) on May 24, 2026, 10:01 PM
tobiu referenced in commit 2ced7ae - "docs(ai): clean lifecycle wake comment archaeology (#11912) (#11919) on May 24, 2026, 10:15 PM
tobiu referenced in commit ccb042c - "chore(ai): clean mailbox source comments (#11912) (#11920) on May 24, 2026, 11:35 PM