Skip to content

Add loop pattern library: five templates + wizard Template Mode (v0.3.0)#15

Merged
ksimback merged 2 commits into
mainfrom
pattern-library
Jul 6, 2026
Merged

Add loop pattern library: five templates + wizard Template Mode (v0.3.0)#15
ksimback merged 2 commits into
mainfrom
pattern-library

Conversation

@ksimback

@ksimback ksimback commented Jul 5, 2026

Copy link
Copy Markdown
Owner

Summary

Implements the pattern library (roadmap Part 3 #1): named, pre-designed loops the wizard customizes instead of starting from a blank interview.

  • templates/loops/ — five templates, each a complete, compiler-validated loop.yaml with {{PLACEHOLDER}} slots, a README (use-when, placeholder table, customization notes), and helper check scripts where the pattern needs them:
    • security-scan — promoted from the real run that produced hermes-ecosystem's security fixes; ships a fresh streaming scan-secrets.py (worktree + git history, vendor paths skipped, masked excerpts only)
    • code-review, bug-hunt, docs-sync, research-synthesis
  • /looper [target-dir] --template <name> — Template Mode in SKILL.md: a compressed interview (placeholders, model selection, paths) that keeps the full critique, structural rules, privacy statement, and ASCII preview. A template is a pre-answered interview, not a bypass.
  • Compiler guardcompile warns on unresolved {{PLACEHOLDER}} tokens; the wizard treats the warning as an emit blocker, so CI can compile raw templates while a half-customized loop can't ship silently.
  • Docs/release — README "Start from a pattern template" section, catalog index with contribution notes, CHANGELOG 0.3.0, version bump.

Test plan

  • python -m unittest discover -s tests — 18/18 green (16 existing + 2 new: every template compiles with the expected placeholder warning and is listed in the catalog; the warning disappears after substitution)
  • Raw compile of all five templates: each succeeds and warns with exactly its expected tokens
  • E2E smoke: code-review template with placeholders filled compiles with no warning; check-review.py fails a TBD-laden report and passes a well-formed one
  • scan-secrets.py standalone: detects seeded AWS-key/email candidates with masked excerpts, skips node_modules, history mode verified against a repo with a deleted secret

🤖 Generated with Claude Code

ksimback and others added 2 commits July 5, 2026 14:42
templates/loops/ ships five named, pre-designed loops the wizard
customizes instead of starting blank: security-scan (promoted from the
real hermes-ecosystem run), code-review, bug-hunt, docs-sync, and
research-synthesis. Each is a complete, compiler-validated loop.yaml
with {{PLACEHOLDER}} slots, a README (use-when, placeholder table,
customization notes), and helper check scripts where needed.

- /looper [target-dir] --template <name>: compressed interview that
  asks only for placeholders, models, and paths; critique, structural
  rules, privacy statement, and preview still run.
- looper.py compile now warns on unresolved {{PLACEHOLDER}} tokens;
  the wizard treats the warning as an emit blocker.
- scan-secrets.py: streaming secret/PII sweep (worktree + git history),
  vendor paths skipped, masked excerpts only.
- Tests 16 -> 18: every template must compile with the expected
  placeholder warning and appear in the catalog; the warning must
  disappear after substitution.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
High-effort review of PR #15 surfaced real defects in the new template
scripts. Fixes:

scan-secrets.py
- Match underscore-joined credential names (SECRET_KEY, DB_PASSWORD,
  client_secret) — the trailing \b rejected exactly those.
- Drop over-broad "test"/"sample"/"dummy"/"fake" placeholder markers that
  suppressed real secrets (e.g. Contest2024!).
- Dedupe on a hash of the raw value, not the masked form, so distinct
  secrets that mask alike are no longer silently collapsed; mask no longer
  leaks exact length.
- Prune skipped dirs in the walk (os.walk) instead of rglob-then-filter;
  drop dead "*.ipynb checkpoints" glob (skip .ipynb_checkpoints dir).

Checker scripts (all five)
- Fix PLACEHOLDERS regex so a standalone "???" is actually caught (\b
  can't bound a non-word char).
- Waive required-field validation only for a genuine empty report — a
  standalone no-findings line AND no finding signal (severity/file:line/
  status) — closing the incidental-substring bypass in check-findings,
  check-review, check-drift-report.
- check-citations: require cited paths resolve to a file UNDER the sources
  dir (reject drafts/same-basename files elsewhere).

Templates / compiler / docs
- bug-hunt: REPRO_CMD/TEST_CMD are string-form checks (compiler
  shlex-splits) so a substituted multi-word command yields a valid argv,
  not an unexecutable one-element list.
- find_placeholders scans dict keys too.
- SKILL.md: existing loop.yaml (edit/resume) takes precedence over
  --template; commands/looper.md: target dir may contain spaces.

Tests 18 -> 27: scanner detection/dedupe/masking and checker gate-bypass
regressions.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@ksimback
ksimback merged commit 269d8b6 into main Jul 6, 2026
9 checks passed
@ksimback
ksimback deleted the pattern-library branch July 6, 2026 05:12
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