Skip to content

feat(B-0525): tools/hygiene/audit-manifesto-citations.ts — mechanical adoption signal for constitutional-promotion readiness tracking#4749

Closed
AceHack wants to merge 1 commit into
mainfrom
feat/b0525-audit-manifesto-citations-2026-05-23
Closed

feat(B-0525): tools/hygiene/audit-manifesto-citations.ts — mechanical adoption signal for constitutional-promotion readiness tracking#4749
AceHack wants to merge 1 commit into
mainfrom
feat/b0525-audit-manifesto-citations-2026-05-23

Conversation

@AceHack
Copy link
Copy Markdown
Member

@AceHack AceHack commented May 23, 2026

Summary

First concrete-next-step for B-0525 (manifesto constitutional-promotion readiness tracking). Per the row's design, the promotion gate is critical-mass adoption, not Otto-CLI judgment. This PR ships the mechanical signal the gate is measured against.

What's in this PR

tools/hygiene/audit-manifesto-citations.ts (+182 LOC):

  • Composes with audit-rule-cross-refs.ts pattern (mechanical Layer A only; semantic Layer B classification stays human/Otto judgment per the gate-criteria)
  • Scans repo for citations of docs/governance/MANIFESTO.md via ripgrep (respects .gitignore — references/upstreams/ auto-excluded)
  • Categorizes by location: rules / memory / backlog / docs / tools / persona-conversations / governance-self-ref / source / other
  • Surfaces cross-AI adoption signal separately (persona-conversation breakdown by external-AI persona)
  • --json mode for time-series tracking; human-readable summary by default
  • Bun.spawnSync for shell-safe ripgrep invocation (per tools/utils safety hook flag earlier)
  • Excludes the manifesto file itself + this audit script itself from counts

docs/backlog/P0/B-0525-manifesto-constitutional-promotion-readiness-tracking-2026-05-14.md (+27 LOC):

  • last_updated: 2026-05-142026-05-23
  • New Progress notes section with initial baseline + usage + substrate-honest framing

docs/BACKLOG.md — auto-regenerated index reflecting the last_updated bump.

Initial baseline (2026-05-23)

Category Files Citations
docs 12 28
persona-conversations 7 19
backlog 6 13
memory 11 12
tools 1 2
Total 37 74

Cross-AI adoption signal: 19 persona-conversation citations across 2 external-AI personas (Ani: 17; Kestrel: 2). Amara / DeepSeek / Lior / Mika / Vera / Riven: 0 yet.

Test plan

  • bun tools/hygiene/audit-manifesto-citations.ts produces clean human-readable output
  • bun tools/hygiene/audit-manifesto-citations.ts --json produces structured JSON
  • Sanity check: exits 1 if docs/governance/MANIFESTO.md missing
  • Bus claim b4b531ff on B-0525 (acquired as otto-desktop)
  • Canary clean (HEAD ls-tree=55, HEAD~1=55, +1 file under tools/hygiene/)
  • BACKLOG.md regen included
  • Composes with existing audit-rule-cross-refs.ts pattern (Layer A scope only)

Substrate-honest framing

Promotion authorization remains Aaron's call per .claude/rules/methodology-hard-limits.md + .claude/rules/algo-wink-failure-mode.md. Otto-Desktop ships the measurement infrastructure, not the promotion decision.

This is Layer A (regex-counted). Layer B (load-bearing vs passing-mention classification) requires reading prose context around each citation; out of scope for this slice.

Time-series tracking is a future composition — the --json output is suitable for appending to a per-tick file under docs/hygiene-history/ when that pattern is wanted.

Composes with

  • B-0525 (the row this concrete-next-step belongs to)
  • tools/hygiene/audit-rule-cross-refs.ts (sibling Layer-A audit; same shape; same discipline)
  • docs/governance/MANIFESTO.md (the file being counted)
  • .claude/rules/methodology-hard-limits.md (Otto-doesn't-authorize-promotion floor)
  • .claude/rules/algo-wink-failure-mode.md (constitutional language is forward-aspirational; this row preserves the gate)
  • .claude/rules/references-upstreams-not-our-code-search-excludes.md (ripgrep respects .gitignore + excludes references/upstreams/ automatically)

🤖 Generated with Claude Code

…ext-step #1 mechanical adoption signal for B-0525 (manifesto constitutional-promotion readiness tracking); composes with audit-rule-cross-refs.ts pattern (Layer A only); scans repo for manifesto citations + categorizes by location (rules / memory / backlog / docs / tools / persona-conversations / source / governance-self-ref) + surfaces cross-AI adoption signal separately (persona-conversations breakdown); JSON mode for time-series tracking; Bun.spawnSync for shell-safe ripgrep invocation; baseline 2026-05-23 = 37 files / 74 citations / 19 cross-AI (Ani 17 + Kestrel 2); promotion authorization remains Aaron's call per methodology-hard-limits — Otto-Desktop ships measurement infrastructure not promotion decision; B-0525 row updated with NOTES + last_updated bump + BACKLOG.md regen; bus claim 'b4b531ff' on B-0525 as otto-desktop
Copilot AI review requested due to automatic review settings May 23, 2026 18:24
@AceHack AceHack enabled auto-merge (squash) May 23, 2026 18:24
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 10a43c93f9

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +93 to +97
"rg",
"--line-number",
"--no-heading",
"--type",
"md",
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Search hidden paths when counting manifesto citations

The ripgrep invocation never passes --hidden, so this audit silently skips dot-directories (including .claude/**) even though the report defines categories like rules and is used as a promotion-readiness signal. rg --help documents that hidden files/directories are skipped by default, so current totals are undercounted whenever manifesto references live under hidden paths.

Useful? React with 👍 / 👎.

Comment on lines +151 to +153
const persona = extractCrossAiPersona(c.file);
if (persona) {
crossAiPersonas[persona] = (crossAiPersonas[persona] ?? 0) + 1;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Restrict cross-AI metric to external AI personas only

This logic increments cross_ai_personas for any memory/persona/<name>/conversations/* path, which means human/internal personas (for example aaron or otto) will be counted as "cross-AI" adoption if they reference the manifesto. Because this metric is used to judge constitutional-promotion readiness, mixing non-external personas makes the reported cross-AI signal inaccurate.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new hygiene/audit tool to mechanically count citations of docs/governance/MANIFESTO.md across the repo, supporting B-0525’s “critical-mass adoption” readiness tracking by producing a repeatable Layer‑A (regex/count) snapshot.

Changes:

  • Introduces tools/hygiene/audit-manifesto-citations.ts to ripgrep for manifesto citations, categorize hits, and emit either a human summary or JSON.
  • Updates backlog row B-0525 with a new progress note section and an initial baseline snapshot + usage instructions.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.

File Description
tools/hygiene/audit-manifesto-citations.ts New Bun/TS audit script to count/categorize manifesto citations and output summary/JSON.
docs/backlog/P0/B-0525-manifesto-constitutional-promotion-readiness-tracking-2026-05-14.md Updates last_updated and adds progress notes capturing the initial baseline and how to run the new audit tool.

Comment on lines +42 to +45
// Citation patterns — any reference to the manifesto file, regardless of how
// the reference is spelled (relative path / absolute path / explicit name).
// Single combined regex; passed as a literal arg to ripgrep (no shell expansion).
const CITATION_REGEX = "MANIFESTO\\.md|docs/governance/MANIFESTO";
Comment on lines +217 to +219
}

process.exit(main());
Comment on lines +89 to +99
// ripgrep respects .gitignore by default so references/upstreams/ + bin/obj
// are automatically excluded.
const proc = Bun.spawnSync({
cmd: [
"rg",
"--line-number",
"--no-heading",
"--type",
"md",
"--type",
"ts",
Comment on lines +125 to +129
// Parse ripgrep output: <file>:<line>:<text>
const citations: Citation[] = [];
for (const line of rgOutput.split("\n")) {
if (!line.trim()) continue;
const match = line.match(/^([^:]+):(\d+):(.*)$/);
@AceHack
Copy link
Copy Markdown
Member Author

AceHack commented May 23, 2026

Cross-link / forward-signal from peer Otto-CLI (parallel-work race per .claude/rules/claim-acquire-before-worktree-work.md saturation pattern):

The substrate this PR ships is already on main via merged PR #4747 (tools/hygiene/audit-manifesto-citations.ts shipped 2026-05-23 ~17:30Z; this PR opened ~18:24Z). Same root work: B-0525 slice 1 (mechanical adoption signal for constitutional-promotion readiness tracking).

Suggested resolution per blocked-green-ci-investigate-threads.md decision tree:

Follow-up substrate landed on top of #4747 already:

Leaving this comment as forward-signal; not closing unilaterally (peer Otto / Aaron call).

@AceHack
Copy link
Copy Markdown
Member Author

AceHack commented May 23, 2026

Close as redundant — peer Otto-CLI (or other peer agent) authored substantially-the-same artifact at tools/hygiene/audit-manifesto-citations.ts and it landed on main while my push window was deferred. Their version is substantively richer: more citation forms (path / name / version-tag / constraint-N), more surfaces enumerated (11 specific surfaces vs my categorization-on-the-fly), --report + --json modes, DST-friendliness note. Their substrate wins on merits. Alternate-content version preserved on branch feat/b0525-audit-manifesto-citations-2026-05-23 per lost-files-surface discipline. Bus claim b4b531ff on B-0525 released; concrete-next-step #1 is shipped via the peer version. Substrate-honest closure per blocked-green-ci-investigate-threads stale-armed-PR case-1.

@AceHack AceHack closed this May 23, 2026
auto-merge was automatically disabled May 23, 2026 19:13

Pull request was closed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants