Skip to content

docs: add command hygiene & context discipline rules - #20

Closed
atrawog wants to merge 2 commits into
mainfrom
feat/command-hygiene
Closed

atrawog wants to merge 2 commits into
mainfrom
feat/command-hygiene

Conversation

@atrawog

@atrawog atrawog commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

Summary

Add a Command hygiene & context discipline section to the umbrella AGENTS.md — the recurring self-inflicted context-waste failure where grep <pattern> <huge-file> | head -N floods output with grep: write error: Broken pipe (the harness runs commands with SIGPIPE ignored, so grep never dies on the closed pipe and prints EPIPE per failed write) and truncates the response.

The new rules are mandatory:

  • grep -m N for "first N matches" — never grep | head (grep terminates itself; no closed pipe; deterministic everywhere)
  • Redirect large outputs to a file first, then read with grep -m N / sed -n 'a,bp'
  • Bound every command's output or redirect to a file
  • Delegate output-heavy investigation to a subagent (log archaeology, repo-wide greps, build/validator loops) — the subagent returns a concise verdict + evidence paths, keeping the main context clean
  • Never re-issue the same diagnostic command in a loop — change the approach instead

How tested

Docs-only change class. The rules are prose in the rulebook; no runtime path changed. The failure mode they address was reproduced live (hundreds of grep: write error: Broken pipe lines from grep | head on a multi-MB build log) and the fix (grep -m N) verified to produce clean bounded output.

Rulebook compliance

Rule How / N/A
R1 RCA performed: the broken-pipe flood was traced to SIGPIPE-ignored execution + `grep
R3 One canonical rule set in AGENTS.md; no duplication
R4 The fix is a deterministic rule (grep -m N), not a workaround
R6 status checked; no force-push; feat-branch + PR landing
R7 N/A — docs-only change class
R10 N/A — docs-only change class

Change classification

  • Change class: documentation (rulebook)
  • Verification gate: non-runtime standards
  • Attribution tier: documentation reviewed

Assisted-by: pi openrouter/deepseek/deepseek-v4-flash-0731 (documentation reviewed)

The 15 most-required base candies move to their standalone kind-prefixed repos
(layer-*/pod-*): the umbrella checks them out like every other org repo,
following their own default-branch HEAD. Verify: 39 submodules, policy B holds.
The harness runs commands with SIGPIPE ignored, so `grep <pat> <huge> | head -N`
floods output with `grep: write error: Broken pipe` (grep never dies on the
closed pipe) and truncates the response — a recurring self-inflicted
context-waste failure. Add mandatory rules: `grep -m N` instead of
`grep | head`, redirect large outputs to files before reading, bound every
command's output, delegate output-heavy investigation to subagents, and never
re-issue the same diagnostic command in a loop.
@github-actions

Copy link
Copy Markdown
Contributor

Review — BLOCK

Head SHA: c92eaa038a8019250a875bccd77cbbb884c8c026 (PR #20)

Change class: claimed docs-only, but the diff is a mixed docs + config/cutover change.

Security screen — T3 scope mismatch: the diff adds 16 new submodule registrations (.gitmodules + 16 gitlinks: layer-supervisord, layer-nodejs, layer-golang, pod-dbus, pod-pipewire, layer-ffmpeg, pod-sway, layer-cuda, layer-tmux, layer-socat, pod-selkies, layer-chrome, layer-python, layer-gemini, pod-chrome-cdp) via commit 93b1609ced5c ("chore: the batch-1 candy repos become submodules (the candy cutover)"). The PR body mentions none of this — its Summary, How-tested, and classification cover only the AGENTS.md prose change.

Blocks

  1. T3 / A1 — undocumented scope + incomplete body. The body accounts for exactly one of the two changes in the diff. The entire candy-submodule cutover (.gitmodules config change, 16 new gitlinks) is missing from the Summary, How tested, Rulebook compliance, and classification. A description↔code mismatch is a BLOCK; every diff item must be accounted for. Fix: split the submodule cutover into its own PR with full documentation and evidence, or add complete accounting + validation for it here.

  2. A2 — change-class gate mismatch (fraud-class). The body claims "docs-only change class", marks R7/R10 as N/A — docs-only, and supplies no runtime evidence. The diff is NOT docs-only: .gitmodules is config and 16 submodule additions are a config/cutover change. No bed run, no fresh-rebuild proof, no disposable-target evidence, no pasted output exists for the submodule cutover — the docs-only gate cannot cover the actual diff. The grep | head failure mode is also asserted as "reproduced live" and "verified" with zero pasted output, which violates the body-evidence standard for the claims it does make.

  3. A3 — inflated attribution tier. Claimed tier documentation reviewed is legal ONLY when the whole diff is documentation; it is explicitly forbidden if code or config also changed. Config (AGENTS.md + submodule config) changed here, so the tier is invalid regardless of how the prose reads.

  4. B15 — non-atomic PR. Two unrelated logical changes (the candy cutover commit and the rulebook docs commit) are bundled into one PR, with the PR title/body describing only one. Even under squash, the scope mismatch in blocks 1–2 survives. No partial/split-work justification is offered.

Comment intake: no comments on the thread — nothing to disposition. CI: both checks (validate, verify) are in_progress with no conclusion, so no green CI can be cited as evidence.

Verdict: BLOCK


deepseek.com/deepseek-v4-flash — pi-review-action.

View action run

@atrawog

atrawog commented Aug 24, 2026

Copy link
Copy Markdown
Contributor Author

Closing: the branch accidentally carried an already-merged submodule commit. Reopening from a clean branch (feat/command-hygiene-clean) with only the AGENTS.md change.

@atrawog atrawog closed this Aug 24, 2026
github-actions Bot pushed a commit that referenced this pull request Sep 4, 2026
…al guide #19 + GPU clone entity #20) (#133)

* chore(gitlink): advance eval-omarchy to main (9919151 — the Tier-2 eval guide #19 + the GPU clone entity #20)

* docs: correct the RCA base SHA (35b61d2, not 34507f41)
github-actions Bot pushed a commit that referenced this pull request Sep 4, 2026
…GELOG) (#135)

* docs: correct the RCA base SHA (35b61d2, not 34507f41)

* chore(gitlink): advance eval-omarchy to main (369c5f0 — post-#20 CHANGELOG)
github-actions Bot pushed a commit that referenced this pull request Oct 6, 2026
* chore: sync gitlinks — 45 pins advanced to what policy B requires

`./charly/bin/charly task pins --param MODE=bump` over a tree reset to origin/main
(89d318b): 45 submodule gitlinks move and nothing else — no file content, no workflow,
no script, no Go.

charly rolls c5ea6c91 -> c0912d8a, eight commits. Main's pin was an ancestor of charly's
current default-branch HEAD, so the scheduled sync workflow's removal in #375 left it
stale; this hand-run walk is the replacement for it. The six distro-* pins are then
re-derived from charly's NEW box/* gitlinks, which is what policy B requires and what
the gate asserts:

    verify: 6 policy pin(s) hold across 425 submodule(s)

charly's own nested submodules follow the same rule, and `charly task verify` audits
them: `git submodule update --init --recursive` brings charly/box/* to the gitlinks
c0912d8a records (box/omarchy -> 6ecfbbce, box/ubuntu -> d2922298, ...), so every
initialized checkout in the tree sits at its recorded gitlink with a clean worktree.

ONE file changes with the pins, because the pin advance is what makes it wrong:
`marketplace` 71ba83ba -> ac7d97e5 adds two skill families (`kubevirt`, `qdrant`), and
`reasonix.toml`'s `[skills] paths` — the only surface in this repo that enumerates the
marketplace skill roots — did not list them. `scripts/check-harness-config.mjs` check 8
catches exactly that, and did: 40 roots listed, 42 on disk. Both are added, and the
block's two counts are restated as the on-disk measurement (42 dirs: 40 `skills/`
holding 351 `SKILL.md`, 2 `agents/` rosters holding 7 `.md`) rather than the stale
"40"/"362", since reasonix is not installed here and its loaded-skill count cannot be
re-measured.

The pins come from the canonical verb, never a hand-edit. `charly task sync` — the
umbrella wrapper — aborted in this tree before any pin was committed:

    task sync: 1 step(s), 1 failed
      [fail] run — bump the pins (charly rolls first, then distro-* from its new gitlinks)
          task "pins" failed (1 step(s) failed)

ROOT CAUSE, and it is not this diff's: `git-submodules` mode `bump` returns at the FIRST
failing path — `if st, msg := pinSubmodule(...); st != spec.StatusPass { return st, msg }`
in phase 1 (candy/plugin-task/verbs.go:245 on plugin-task main, the same statement at
v0.2026277.711's line 244-245). `pinSubmodule` ends by staging the move in the
SUPERPROJECT (`git add <path>`, verbs.go:334-337), and every session's git process
contends for that one `.git/index.lock`; a single held lock therefore fails one path,
and one failed path strands every pin sorted after it and skips phase 2 entirely, which
is why the six distro-* pins were never derived. That defect is OPEN and tracked: it is
plugin-task#13 verbatim ("a momentarily held superproject .git/index.lock is enough to
do it"), and plugin-task#15 is its open fix. The failing path's identity is not
recoverable from this run: the nested `task:` hop destroyed the message at the vintage
this binary resolves (candy/plugin-task/cli.go:353-354, `task "pins" failed (N step(s)
failed)`), which is plugin-task#12 — since CLOSED by #20 (`085f411`, merged
2026-10-05), upstream, waiting only on the next plugin-task bump.

Nothing here is owed to it: the canonical verb run directly completes the same walk on
the same inputs, exit 0, all 425 pins named, and the pins in this commit are that run's.

This commit re-cuts its predecessor: tree 7610912, byte-identical to the tree the
first thread (#391) published and was reviewed on. Only the commit
message and the PR body changed, answering that review's three findings — the abort's
R1 disposition (now the RCA above, naming plugin-task#13/#15 instead of calling it
"transient"), an R0 line that named the wrong command, and a gate transcript produced
with the installed plugin directory hidden by a mount namespace. The last of those is
now a gate run on an UNMODIFIED host, notice and all.

* chore: re-walk the pins so plugin-task records the walk-abort fix

The validator's second finding on this PR was that the abort's fix
(plugin-task#21 / 70a530e2) was not among this PR's pins. It is now.

plugin-task#21's own body establishes the abort's RCA and names this run
(#391): the bump walk returned at the FIRST failing
path, so one path's per-invocation failure stranded every pin sorted
after it, skipped phase 2 entirely, and derived no pin_map entry. Its fix
is released as candy/plugin-task/v0.2026279.1213 = 70a530e2.

The first revision of this branch pinned plugin-task at d4f927d1bbb0, one
commit BEHIND that fix, because its walk ran before the fix merged. The
walk was therefore repeated with the same canonical operation
(charly task pins --param MODE=bump, whose wrapper is charly task sync)
on the unmodified tree, and it is deterministic: a second walk
reproduced these same six moves.

  charly       c0912d8 -> d9fe41b   (its own default-branch HEAD)
  plugin-cache f18bfe0 -> b41857f
  plugin-task  d4f927d -> 4be0a5e   <- contains 70a530e2
  plugin-vm    2bdb7b1 -> f63eb2c
  pod-dsh      6e728d2 -> 92a47e1
  sdk          7d46dce -> 5744d9d

Every pin is its owning repo's default-branch HEAD; policy B holds
(charly task policy-b: 1 step(s), 0 failed). No pin is hand-edited and no
submodule is branch-checked-out to catch up.

Agent: readme-truth - session 2a317871-ba03-4713-89ba-8edbd4059c27
Assisted-by: Claude Code ollama-cloud/deepseek-v4.1-flash (fully tested and validated)

* chore: sync gitlinks — 3 more pins advanced since the walk

Re-ran the canonical walk (`charly task pins --param MODE=bump`, wrapped by
`charly task sync`) after the first pass, at 2026-10-06T14:45Z. Three repos
had merged to their default branch in the interval:

  layer-charly  e2e319c -> 14c7d32  (CHANGELOG 2026.279.1259 for PR #14)
  plugin-dsh    46a45b8 -> 0e6996c  (CHANGELOG 2026.279.1440 for PR #12)
  pod-dsh       92a47e1 -> e385577  (CHANGELOG 2026.279.1426 for PR #13)

All three targets are tag-on-merge CHANGELOG commits on main, i.e. merged
default-branch HEADs. charly's own main was unchanged (d9fe41b), so policy B's
distro-* set is untouched by this second pass.

* chore: sync gitlinks — 2 more pins advanced while the gate ran

Third pass of the canonical walk (`charly task pins --param MODE=bump`) at
2026-10-06T15:05Z, absorbing the merges that landed during the gate run:

  plugin-deploy-pod  e73a481 -> 8c7b491  (PR #27 merged 14:48:46Z)
  plugin-doctor      6664658 -> 22f4de6

This is the last pass: a sync races the next merge by construction, so the PR
body states its walk time and discloses the residual drift by name instead of
chasing it. Two distro-* rows (distro-debian, distro-ubuntu) remain 'not equal'
to their own remote HEAD, which is policy B working as designed — they track
charly's gitlinks, not their own default branch.

* chore: sync gitlinks — the final walk, after merging origin/main

The walk declared last: run once, after the branch was brought up to date with
origin/main, so the pins this head publishes are the canonical verb's own output
on the tree that will be gated and pushed.

* fix(scripts): the pin evidence legend must state how to READ a `!`, not call a benign race a violation

R1 root cause, measured on this sync's own diff. `sync-pin-evidence.sh` renders a
`!` for any moved pin whose staged gitlink is not the owning remote default-branch
HEAD **at the moment the table is generated** — but its legend asserted a blanket
"`charly` and every non-`distro-*` repo must be EQUAL", which reads a snapshot
inequality as a policy violation. The two are not the same thing: a walk resolves
each remote HEAD when the walk RUNS, and the table is generated later, by however
long the PR body takes to assemble. A default branch does not stand still in that
window (the body's own "Why these pins had drifted" already says so), so a
non-`distro-*` `!` has two readings the old legend could not tell apart.

Measured instance: `vm-charly-vm`. The walk ran 2026-10-06T15:07:25Z and pinned
`47c4d063` — then that repo's default-branch HEAD (its predecessor pin `5fd777a3`
was 2026-09-29). The upstream merged at 15:13:00Z / 15:13:14Z, 5m35s after the
walk, so the table rendered `!`. The comparison reports `ahead 2, behind 0`: the
staged pin is an ANCESTOR of the remote HEAD. Benign by construction, disclosed —
not a finding, and the old wording would have called it one.

The legend now states both readings and the check that separates them:
  (a) the sync race — the branch advanced after the walk, so the staged pin is an
      ancestor of the remote HEAD (`git merge-base --is-ancestor` -> true); benign;
  (b) a real finding — the staged pin is not on that default branch at all (a PR
      branch or a non-HEAD commit); that ancestor check is false.

It is a FUNCTION (`evidence_legend`, the pattern this file already uses for every
other shared decision) so the wording is assertable, not a string nobody can
exercise: `--self-test` now fails if either reading goes missing, if the
walk-scoping clause goes missing, or if the blanket "must be EQUAL" claim returns.
Each arm has a negative control (a legend body with the phrase removed fires the
arm; the arms are keyed on the legend text, so the controls neutralize the function
body only — a naive sed rewrites the assertion too and proves nothing).

---------

Co-authored-by: atrawog <[email protected]>
@aitrawog
aitrawog deleted the feat/command-hygiene branch November 1, 2026 19:07
github-actions Bot pushed a commit that referenced this pull request Nov 25, 2026
… releases land (#1274)

`charly task sync` on a tree current with origin/main (7f11b25): 74 leaf
submodules rolled to their default-branch HEAD (11 moved), 321 leaf pins
advanced in the index (11 moved) — 22 pins total. The five distro-* pin_map
edges were re-pinned from charly's own gitlinks and did not move.

Two of the moves are what this wave is for (#1273):

  sdk                2bfea23e -> dd87eb2c   sdk#640 — a unit never runs as container root
  plugin-deploy-pod  c87f056c -> c10caae    #97 — a CDI device rides a keep-id unit via a
                                            derived devices-only spec; #95 writes the
                                            deploy entry's image before any overlay write

The other 20 travelled on the same mechanism, each a merged upstream PR:
charly #1275, layer-cdi #20, layer-vectorchord #13, marketplace #652,
plugin-enc #11, pod-charly-mcp #15, pod-immich #23, pod-qwen3-tts #15/#13,
spec #440, plus eleven unmaterialized paths advanced in the index
(layer-devops-tools #8, layer-ollama-cuda #11, layer-ollama-rocm #9,
layer-pre-commit #9, layer-versatiles-style #7, pod-airflow #15,
pod-android-emulator-layer #21, pod-appium-server #9, pod-dbus #8,
pod-jupyter-ml #15, pod-pmtiles-viewer #7).

The plugin-deploy-pod advance moved engineDefaultRuntime from engine_ops.go:139-146 to
129-136, out from under the citation DESIGN A.13 records for "containerd namespace per
deployment" (design/dulling.tsv). The row is re-anchored to the construct's new range and
design/cite-baseline.tsv regenerated for that one row; the construct read at the new pin is
the same one, and the regenerated baseline changes no other row.

Agent: `immich-consolidation` · Claude Code session `113f762e-5d70-484a-9ed9-e34c6423c926`
Assisted-by: Claude Code deepseek-v4.1-flash:cloud (fully tested and validated)
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.

1 participant