Skip to content

[docs] agent notes: skill direct-orchestration + hook regex word-boundary#82

Merged
trilamsr merged 2 commits into
mainfrom
docs/agent-notes-skill-orchestration-and-hook-matcher
May 19, 2026
Merged

[docs] agent notes: skill direct-orchestration + hook regex word-boundary#82
trilamsr merged 2 commits into
mainfrom
docs/agent-notes-skill-orchestration-and-hook-matcher

Conversation

@trilamsr

@trilamsr trilamsr commented May 19, 2026

Copy link
Copy Markdown
Contributor

Summary

Two agent-internal lessons captured via the learn-from-mistakes capture flow. Not universal enough for AGENTS.md; each lands in its existing topic note where the next skill author or hook designer would naturally look.

.claude/notes/skill-design.md — orchestrate multi-phase skills directly, not through a plugin's $ARGUMENTS. Routing a ~17 KB prompt body through /ralph-loop:ralph-loop's setup-script $ARGUMENTS blew Claude Code's permission classifier mid-session (parser timeout, resource limit, or over-length). PR #73 dropped the dependency and routed the 5 phases to direct Agent-tool dispatches; this note documents why so the next author doesn't hit the same wall. Carves out: plugin delegation is fine for small, well-typed $ARGUMENTS; the lesson scopes to the multi-phase-with-large-prompt shape only.

.claude/notes/automation.md — match shell-command hooks by regex word-boundary, not substring containment. The pre-PR checklist hook (PR #80) iterated through three matcher shapes this session: substring over-fires on echo gh pr create, starts-with misses compound cat > body && gh pr edit, regex word-boundary lands the balance. The note pins the trade-off rationale, decomposes the regex into named parts (leading boundary + alternation + trailing boundary), and carves out: advisory hooks bias toward false positives; blocking hooks should flip to starts-with so unrelated commands aren't forcibly stopped. The trade-off generalizes beyond PR commands.

Test plan

  • make doc-check clean (banned-phrase lint, link resolution, all gates).
  • learn-from-mistakes format check: banned vocabulary absent, no first-person AI phrasing, no AI attribution, both entries carry Anchor: lines.
  • CI on this PR exercises only doc-check + pr-lint (no code changes).

Rollback

Delete the two added entries (each is a self-contained ### title + body + Anchor: block at the top of its file). No dependents elsewhere in the repo; reverting is a single Edit per file.

NONE — agent-internal documentation only. Adds two topic-note entries on skill orchestration and shell-command hook matching. No runtime behavior change.

trilamsr added 2 commits May 19, 2026 01:12
…dary

Captures two agent-internal patterns from this session that aren't
universal enough for AGENTS.md but would help the next skill author
or hook designer avoid the same trap.

skill-design.md: why pr-review-loop dropped its plugin dependency
(Claude Code permission classifier blew up on ~17KB ARGUMENTS;
direct Agent-tool orchestration is the safer shape).

automation.md: why the pre-PR checklist hook uses a regex
word-boundary matcher rather than substring containment or
starts-with — substring over-fires, starts-with under-fires,
word-boundary lands the right balance.

Both files at "Newest-first" ordering convention. Anchors point at
PR #73 and PR #80 respectively. make doc-check clean.

Signed-off-by: Tri Lam <trilamsr@gmail.com>
Self-review on PR #82 surfaced three gaps. This commit closes them:

1. Skill-design carve-out: the lesson now explicitly scopes itself to
   the multi-phase-with-large-prompt shape, not plugins in general.
   A future reader won't over-correct and avoid plugins for small,
   well-typed protocols where they remain the right tool.

2. Automation carve-out + generalization: bias toward false positives
   only when the hook is advisory. Blocking hooks (those that deny
   via permissionDecision) should flip to starts-with so unrelated
   commands aren't forcibly stopped. Also widens the lesson's scope:
   the trade-off generalizes to any shell-command-matching hook, not
   just PR/push commands.

3. Regex decomposed into named parts inline: the (^|[[:space:];&|])
   prefix + alternation + ([[:space:]]|$) suffix structure is now
   visible at a glance rather than as a wall of characters.

make doc-check clean locally.

Signed-off-by: Tri Lam <trilamsr@gmail.com>
@trilamsr trilamsr enabled auto-merge (squash) May 19, 2026 08:18
@trilamsr trilamsr merged commit 41304ff into main May 19, 2026
9 checks passed
@trilamsr trilamsr deleted the docs/agent-notes-skill-orchestration-and-hook-matcher branch May 19, 2026 08:21
trilamsr added a commit that referenced this pull request May 19, 2026
## Summary

Three observations from the recent session that didn't fit the
structured surfaces (already used for the load-bearing AGENTS.md entries
in PR #81 and the agent-internal notes in PR #82). Each captured via the
`learn-from-mistakes` flow and lands in its existing topic note.

**`.claude/notes/automation.md`** — *Memory captures rationale; hooks
enforce.* The pre-PR checklist personal memory landed mid-session was
followed by a lint failure shipped to CI within the hour. The same gap
closed reliably by the `PreToolUse` hook installed shortly after. For
any "always do X before Y" pattern, prefer the hook; the memory
documents *why* the hook exists.

**`docs/notes/ci.md`** — *Frame CI / perf projections as ranges, not
single numbers.* PR #72's 155s wall-time projection vs 242s actual cost
an investigation round (later landed in PR #77) because the projection's
setup-go-cache amortization assumption was unverified. Either verify
assumptions empirically before publishing the number, or frame as a
range.

**`.claude/notes/review-patterns.md`** — *Self-rate work, then write
criteria for the next grade up.* Forces articulation of measurable
improvements rather than free-form "anything else?". PR #76's B+ → A →
A+ came from two iterations of this exact pattern; each iteration closed
real structural gaps.

A fourth lesson — "fix existing tools before proposing new ones" — was
captured to personal memory (no PR, lives in
`~/.claude/projects/.../memory/`), not the repo, because it's a judgment
heuristic about my own decision-making rather than a repo-resident
convention.

## Test plan

- [x] `make doc-check` clean (banned-phrase lint, link resolution, all
gates).
- [x] `learn-from-mistakes` format check: banned vocabulary absent, no
first-person AI phrasing, no AI attribution, all three entries carry
`Anchor:` lines pointing at concrete PRs.
- [ ] CI on this PR exercises `doc-check` + `pr-lint`.

## Rollback

Each entry is a self-contained `### title` + body + `Anchor:` block at
the top of its file. No dependents elsewhere; reverting is a single Edit
per file.

```release-notes
NONE — documentation only. Three meta-lessons from a recent session retrospective land in their existing topic notes (`automation.md`, `ci.md`, `review-patterns.md`). No runtime behavior change.
```

Signed-off-by: Tri Lam <trilamsr@gmail.com>
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