Skip to content

fix(verify): add the "referenced root file exists" landing gate (#356 prevention, supersedes #363) - #365

Merged
github-actions[bot] merged 6 commits into
mainfrom
feat/soul-md-ref-gate-2
Oct 5, 2026
Merged

github-actions[bot] merged 6 commits into
mainfrom
feat/soul-md-ref-gate-2

Conversation

@aitrawog

@aitrawog aitrawog commented Oct 5, 2026

Copy link
Copy Markdown
Contributor

Summary

Supersedes #363, which was auto-closed at the validator's 5-verdict limit (AI_REVIEW_AUTO_CLOSE_AFTER=5). Every finding from its BLOCK verdicts was fixed before this branch existed, in ONE new head: the current head carries the sole residual from #363's final verdict (the rule-compliance section was missing R0/R2/R8 — now added). The predecessor's earlier findings (dead else branch, the redundant/untested DANGLING arm, the unquoted #356 YAML-truncation, and the stale task verify paste) were all fixed on #363's branch, whose tree this branch carries forward verbatim; #363's last verdict dispositioned each of them stale-superseded.

Add the "referenced root file exists" landing gate (prevention item 3 of #356) to the umbrella's charly task verify.

opencharly#356 root-caused a HIGH content loss: the four canonical root narratives — SOUL.md, VISION.md, GRIEVANCES.md, LIBERATION.md — were relocated from the charly submodule root to the umbrella root (where every session is rooted), and the multi-repo cutover landed delete-first — charly#791 removed them and the umbrella PR that added them was auto-closed at the validator's block limit. For a window the files existed in no repository's main, and every agent surface (AGENTS.md, .opencode/instructions.md, .pi/extensions/charly-gates.ts) pointed at charly/SOUL.md, a path that no longer resolved. Nothing in task verify read those surfaces, so no gate could see the loss.

New: scripts/check-root-refs.mjs, wired into the verify plan with a self-test step. It asserts:

  1. the four canonical root narratives exist at the umbrella root; and
  2. every reference to a canonical narrative in an agent surface (AGENTS.md, README.md, .opencode/instructions.md, .pi/extensions/charly-gates.ts) resolves — a charly/<Name>.md reference whose file now lives at the umbrella root is a STALE-reference FAIL (the exact #356 shape). A canonical missing at the root is check 1's failure, so check 2 owns the STALE arm and nothing redundant.

The reference walk is scoped to the four canonical files on purpose: matching every <Uppercase>.md produced false positives on legitimate different files (SKILL.md, charly/AGENTS.md), so the gate covers the narrative-relocation class and nothing else. The canonical list is hardcoded, so a cutover that also deletes the reference (not just the file) still trips the gate.

Two files changed: scripts/check-root-refs.mjs (new) and charly.yml (two verify steps). Part of #356 — this is the mechanical gate (prevention item 3); the remaining prevention items (the relocation ordering rule — add-before-delete — and the "do not auto-close a multi-repo cutover's middle producer without a successor" rule) land as rulebook/skill edits, so #356 stays open until those land.

How tested

All output below was re-run on the final head bf7ebfb41bff2fe36231ce52e9e083e420a30214 (after gh pr update-branch; no force-push).

The new gate on the current tree (the four narratives are present at the umbrella root after #357; the three surface references were repointed to the bare names):

$ node scripts/check-root-refs.mjs
check-root-refs: OK — 4 canonical root narratives present; every root-file reference in the agent surfaces resolves
$ echo $?
0

The self-test — it proves the gate DISCRIMINATES by EXECUTING it against mutated trees (each mutation must turn it RED; a restored tree GREEN):

$ node scripts/check-root-refs.mjs --self-test
  pass — baseline: narratives + a bare ref present (expected GREEN, got GREEN)
  pass — SOUL.md removed (check 1) (expected RED, got RED)
  pass — stale charly/SOUL.md reference (STALE arm) (expected RED, got RED)
  pass — non-narrative refs are ignored (scoping) (expected GREEN, got GREEN)
  pass — restored correct tree (expected GREEN, got GREEN)
check-root-refs --self-test: 5 passed, 0 failed

Every surviving arm is load-bearing — MEASURED by deleting an arm and re-running the self-test (a test that cannot fail without its arm is not coverage):

$ sed '/STALE reference/d' scripts/check-root-refs.mjs > /tmp/crr-nostale.mjs
$ node /tmp/crr-nostale.mjs --self-test
  FAIL — stale charly/SOUL.md reference (STALE arm) (expected RED, got GREEN)
check-root-refs --self-test: 4 passed, 1 failed

Removing the STALE push turns its mutation GREEN, so the arm is genuinely exercised. (Check 1 is proven the same way by its own removed-canonical case. The prefixed DANGLING push this gate previously carried was redundant with check 1 — a canonical missing at the root already fails check 1 — so it was removed rather than tested, per the validator's finding.)

The #356 shape reproduced against a temp tree — root narratives present, AGENTS.md still pointing at charly/SOUL.md:

$ node scripts/check-root-refs.mjs --root /tmp/opencode/rootrefs-neg2
check-root-refs: FAIL — AGENTS.md: STALE reference `charly/SOUL.md` — the file lives at the umbrella root `SOUL.md`; repoint the reference
check-root-refs: 1 failure(s)
$ echo $?
1

The full gate on the final tree — ./charly/bin/charly task verify (the description renders IN FULL — the value is quoted in charly.yml, so the inline #356 is not read as a YAML comment):

$ ./charly/bin/charly task verify
task verify: 11 step(s), 0 failed
  [pass] check — policy B — every distro-* gitlink equals charly's own box/* gitlink
      ran 1 task(s), 0 step(s) failed
  [pass] check — every submodule is clean and checked out at its recorded gitlink, and its branch equals the remote default
      exit=0
  [pass] check — the submodule-cleanliness step above — uninitialized paths are a NOTICE, real defects still FAIL (fixtures)
      exit=0
  [pass] check — the opencode gate plugin contract (the check-opencode-plugin gate the former verify-pins.sh ran)
      exit=0
  [pass] check — the PR-watch plugin's pure logic + its shipped (uncommented) SDK delivery primitives
      exit=0
  [pass] check — the agent-progress monitor+control plugin — static (no .sh), the classifier (RCA regression), and a read-only store
      exit=0
  [pass] check — the session tracker plugin — the durable ledger (rule 11 invariant), the three tools, and the real-binary load
      exit=0
  [pass] check — every harness-config surface parses and is wired (rule 8)
      exit=0
  [pass] check — the pi gate extension fails CLOSED, uses the rule-9 worktree path, and wires both gate scripts
      exit=0
  [pass] check — every canonical root narrative exists and every root-file reference in the agent surfaces resolves (the #356 content-loss gate)
      exit=0
  [pass] check — the root-ref gate discriminates — each mutation turns it RED (fixtures)
      exit=0

Rulebook compliance

Every applicable rule answered (or N/A with a reason):

  • R0 — Skills First. Loaded before the first edit: /charly-internals:git-workflow (the landing loop), /charly-check:check (R10/gate authoring), /charly-internals:cutover-policy, and the umbrella AGENTS.md rulebook.
  • Rule 1 / R1 — PR + RCA. Landed by PR; the gate implements the RCA'd prevention from CONTENT LOSS: SOUL/VISION/GRIEVANCES/LIBERATION exist in no main — RCA + prevention #356 (itself root-caused in the issue, not classified "pre-existing"/"out of scope"). No failure is being papered over — the anomaly is fixed on the canonical surface (the verify gate).
  • R2 — Finish the Cutover. The gate fully closes the class it targets (a missing canonical narrative + a stale pointer). The remaining CONTENT LOSS: SOUL/VISION/GRIEVANCES/LIBERATION exist in no main — RCA + prevention #356 prevention items (1: add-before-delete ordering; 4: no auto-close of a multi-repo cutover's middle producer without a successor) are genuinely separable, non-blocking rulebook/skill edits — scoped to their next batch (CONTENT LOSS: SOUL/VISION/GRIEVANCES/LIBERATION exist in no main — RCA + prevention #356 stays open until they land), not parked.
  • R2a — Subagents/Fabric. N/A — a small, focused checker with no heavy exploration, log archaeology, or repeated diagnostics to delegate.
  • R3 — No Duplication. One implementation, check(); the --self-test drives the SAME code path against mutated trees (no parallel re-implementation). Check 2 owns only the STALE arm — the missing-canonical case is check 1's, not duplicated.
  • R4 — No Workarounds. The gate is wired into task verify; no ad-hoc shell, no hand-run substitute, no fallback branch.
  • R4a — Fix the Product First. The fix is a product capability (the verify gate), not a documentation workaround routing around a defect.
  • R5 — Delete Legacy Completely. The gate covers the relocation class end to end (missing file via check 1; stale pointer via check 2). No stale reference, shim, or dead arm remains (the redundant DANGLING arm was deleted).
  • R6 — Git Safety. Landed by PR; no force-push; the head advanced only by add-merges.
  • R7 — Prove Behavior. The self-test EXECUTES every mutation and asserts the RED/GREEN outcome, and the body MEASURES that each surviving arm is load-bearing by deleting the arm and re-running.
  • R7a — Live or Skip. N/A — the gate is pure, deterministic in-repo logic (no live-service boundary to fake); the self-test runs real filesystem mutations.
  • R8 — Preserve Emitted Artifacts. N/A — the change adds a verify step; it touches no generated artifact, label, plan, config schema, or emitted file. (The charly.yml edit is the umbrella's own task surface, not a generated artifact.)
  • R9 — Binary Equals Source. The gate ran through the umbrella's own ./charly/bin/charly task verify (the committed binary).
  • R10 — Fresh Disposable Proof. The full task verify ran on the final committed tree (11/11, pasted above).

Change classification

  • Change class: umbrella verify gate — a new scripts/*.mjs checker + two charly.yml verify steps (the umbrella's own task surface; no submodule edit).
  • Verification gate: ./charly/bin/charly task verify on the final tree — 11/11 PASS, including the two new steps.
  • Attribution tier: fully tested and validated — the full gate passed on the final tree and the changed path (the new checker) executed with retained output, plus the self-test proving discrimination.

Closes nothing on its own — part of #356 (prevention item 3). Relates to #357 (the restoration this gate would have caught).
Agent: soul-md · session ses_ef8af7149ffe5G0oj20EhTQn6V
Assisted-by: OpenCode DeepSeek V4.1 Flash (fully tested and validated)

atrawog and others added 6 commits October 5, 2026 06:34
…prevention)

The four canonical root narratives were relocated delete-first across two
repos and briefly existed in no main (#356). Nothing in task verify read the
agent surfaces that referenced them, so no gate saw the loss.

scripts/check-root-refs.mjs asserts (1) the four canonical narratives exist at
the umbrella root, and (2) every reference to a canonical narrative in an agent
surface (AGENTS.md, README.md, .opencode/instructions.md, .pi/extensions/
charly-gates.ts) resolves — a `charly/<Name>.md` reference whose file now lives
at the umbrella root is a STALE-reference FAIL, the #356 shape. Wired into the
verify plan with a --self-test step that proves it discriminates.

Assisted-by: OpenCode DeepSeek V4.1 Flash (fully tested and validated)
Addresses the two blocks on #363 in one commit:
1. B14a/B18 — the `else` branch after the `!prefix` guard was unreachable, and the
   `if (prefix)` wrapper redundant. Collapsed to a prefixed-only walk (the bare-name
   case is check 1s).
2. B12 — the prefixed DANGLING arm had no mutation. Added `notes/SOUL.md` (a prefix
   that is neither a file nor a submodule) to --self-test, so the arm is exercised.

Assisted-by: OpenCode DeepSeek V4.1 Flash (fully tested and validated)
…tion

Addresses the two blocks on #363 (head e803020) in one commit:

1. B12 — the prefixed DANGLING push was redundant with check 1 (a canonical
   narrative missing at the umbrella root already FAILs check 1), so it could
   never be reached by a mutation without check 1 also firing. Removed it: check
   2 now owns ONLY the STALE arm, and every surviving arm has a mutation that
   fails without it (check 1 by the SOUL.md-removed case, STALE by charly/SOUL.md).
2. B18/A1 — the verify step description carried an unquoted inline `#356`, which
   YAML read as a comment — the rendered check name was truncated at `(the`.
   Quoted the value so it renders in full.

Assisted-by: OpenCode DeepSeek V4.1 Flash (fully tested and validated)
@github-actions

github-actions Bot commented Oct 5, 2026

Copy link
Copy Markdown
Contributor

Review — PASS

Head SHA: bf7ebfb41bff2fe36231ce52e9e083e420a30214 (branch: feat/soul-md-ref-gate-2)

Security screen: PASS — no instruction-injection in body/commits/diff (T2); the new scripts/check-root-refs.mjs is a pure read-only existence/reference checker (no secrets, no network/egress, no eval, no obfuscation); charly.yml only ADDS two verify steps (no guardrail weakened, no dependency/pin/CI-script change); nothing touches this validator's spec or the rulebook (T3/T4).
Change class: umbrella verify gate — new scripts/*.mjs checker + two charly.yml verify steps (static checker; no bed/disposable target exists for the class). Description↔diff match: both files accounted for, two checks implemented as described (check 1 missing-canonical; check 2 STALE prefixed-ref arm), the redundant DANGLING arm genuinely subsumed by check 1+2, so no coverage gap and no dead arm (R5/B14a clean).
Checklist: All applicable rules PASS or NA. Evidence cross-checks internally consistent — task verify step list (11 steps, two new ones matching the quoted charly.yml descriptions), self-test (5/5, each mutation RED/GREEN as asserted), arm-deletion output (failures.push() no-op → mutation 2 GREEN, 4/5), and --root negative repro all reconcile with the diff; changed path executed live (steps 10/11 exit=0); --self-test is coverage that would fail without the new code (B12). Attribution fully tested and validated is justified by the executed changed path; the *Assisted-by:* trailer is present in correct form and last, preceded by the Agent: line (A1). Tool-limited: I cannot re-run the beds or verify the model-name string — no contradiction found, so no finding.
Comments: none (0-comment thread) — nothing to disposition.

Verdict: PASS


ollama-cloud/deepseek-v4.1-flash — action-review.

View action run

@github-actions
github-actions Bot enabled auto-merge (squash) October 5, 2026 05:26
@github-actions
github-actions Bot merged commit a04e69f into main Oct 5, 2026
1 of 3 checks passed
charly-auto-merge Bot added a commit that referenced this pull request Oct 5, 2026
github-actions Bot pushed a commit that referenced this pull request Oct 5, 2026
)

* docs(agents): SOUL identity + a 10-rule rulebook (reland, supersedes #353)

The #353 rulebook rewrite, relanded off current main after #353 was auto-closed
at the validator's 5-verdict limit (its narratives landed via #357, its seam via
plugin-docs#17; the rulebook cut itself did not).

AGENTS.md becomes the identity + the WHAT/MUST, with the skill-owned prose
removed and pointed at its owner:

- a condensed 'You are charly' identity opening (SOUL.md is the full text);
- 11 rules -> 10: merge pins + Policy B; fold the engineering-rules list into a
  single discipline rule 10; delete the prose the skills already own
  (identity/coordination -> git-workflow B2b; main-vs-subagent -> agents
  orchestration-model; subagent lifecycle -> agents hooks-and-lifecycle;
  development model -> git-workflow);
- remove the 'OWNING - ETA' ask from the coordination protocol;
- keep every MUST (R1/R3/R4/R5/R6/R7/R10, live-or-skip, PR-only landing) and
  carry soul-md's R7 nuance (run the gate the change class requires) and the
  umbrella-root SOUL.md pointer.

Rule-number citations swept (rule 9->2, 11->9, 8->5, 4->2) across .opencode,
.pi, the gate scripts, and the charly.yml check labels.

Refs #352; preserves soul-md's #357/#365 work.

* docs(agents): fix the 11->10 sweep's stale prose and restore two dropped clauses

Addresses the #366 BLOCK (R5/B14(d), R5/B10):

- the sweep was mechanical in three places, leaving stale framing that
  contradicted the new rule 9: tracker.ts and instructions.md both claimed rule 9
  'names two branches' (a structured todo primitive vs a durable file) — the new
  rule 9 states only the durable ledger. Reworded to match.
- restore two clauses the fold dropped: rule 3 keeps the sdk/spec-are-recorded-but-
  not-pinned-by-charly statement (builds resolve them from the Go proxy), and rule
  10 keeps the 'no R10 class exemption' clause (a plugin-library/schema change runs
  the full assembled disposable bed; a bed-exemption sign-off is never accepted).

No MUST is subtracted. The sweep is now evidenced by a real grep in the PR body.

Refs #352.

* docs: re-freeze the reland head

No source change — the head now carries the final body: the R5 sweep is evidenced
by a pasted grep, and the two stale-framing hits + two dropped clauses are fixed
in bb492c6. This mints a fresh head so the required pr-validator reads the final
body against the fixed tree.

---------

Co-authored-by: atrawog <[email protected]>
@aitrawog
aitrawog deleted the feat/soul-md-ref-gate-2 branch November 1, 2026 19:11
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