runs-derive
Skill0 starsChanged 10 months agoApache-2.0View on GitHub
Grep/wc replacement for .runs artifacts. Use for: count, extract, Machine Summary, receipt reading, marker counts. Null-safe counting (REQ/NFR/QID/RSK markers), YAML block parsing, BDD scenario counting. Deterministic read-only - no judgment. Use when cleanup agents need mechanical counts/extraction. Invoke via bash .claude/scripts/demoswarm.sh.
- Installs packages
In this repository21 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- .github/copilot-instructions.mdCopilot instructions
- auto-linterSkill
- changelogSkill
- commitSkill
- debugSkill
- docsSkill
- exploreSkill
- featureSkill
- fixSkill
- forensicSkill
- openq-toolsSkill
- policy-runnerSkill
- pr-createSkill
- pr-prepSkill
- refactorSkill
- reviewSkill
- runs-indexSkill
- secrets-toolsSkill
- spec-execSkill
- test-runnerSkill
The file
We split this skill into the rules it gives an agent
5 rules. About 0 are common, 2 are distinctive, and 3 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 9
Read-only, deterministic helpers for .runs/ derivation.
- Distinctive: line 35
All paths are repo-root-relative.
- Very specific: line 177
stdout: Always a single scalar (null, integer, or string)
- Very specific: line 178
exit code: Always 0 (errors expressed via null stdout)
- Distinctive: line 187
When writing cleanup agents:
≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Runs Derive Skill
Read-only, deterministic helpers for .runs/ derivation. Use when cleanup agents need mechanical counts/extraction without interpretation.
Invocation
Always invoke via the shim:
bash .claude/scripts/demoswarm.sh <command> [options]The shim resolves implementation in order:
.demoswarm/bin/demoswarm(Rust binary, preferred)demoswarmon PATH (global install)cargo runfallback (dev environments)- Python fallback (legacy)
Do not set PATH or call helpers directly. The shim handles resolution.
Operating Invariants
Repo root only
- Assume working directory is repo root.
- All paths are repo-root-relative.
Null over guess (counts)
- File/dir missing →
null(NOT0) - Present but no matches →
0 - Present but unparseable / tool error →
null
No writes
This skill only reads. Index updates use runs-index. Secrets use secrets-tools.
Command Reference
| Command | Purpose |
count pattern | Count lines matching regex in a file |
count bdd | Count BDD scenarios in feature files |
ms get | Extract field from Machine Summary block |
yaml get | Extract field from fenced YAML block |
yaml count-items | Count items in YAML block |
inv get | Extract inventory marker value |
line get | Extract value from line with prefix |
receipts count | Count prior flow receipts in run dir |
receipt get | Read field from receipt JSON |
openapi count-paths | Count paths in OpenAPI YAML |
time now | Get current UTC timestamp |
Quick Examples
Counting patterns (stable markers)
# Count functional requirements
bash .claude/scripts/demoswarm.sh count pattern \
--file ".runs/feat-auth/signal/requirements.md" \
--regex '^### REQ-' \
--null-if-missing
# stdout: 5 (or null if missing)
# Count NFRs
bash .claude/scripts/demoswarm.sh count pattern \
--file ".runs/feat-auth/signal/requirements.md" \
--regex '^### NFR-' \
--null-if-missing
# Count BDD scenarios
bash .claude/scripts/demoswarm.sh count bdd \
--dir ".runs/feat-auth/signal/features" \
--null-if-missing
# Count open questions (QID marker)
bash .claude/scripts/demoswarm.sh count pattern \
--file ".runs/feat-auth/signal/open_questions.md" \
--regex '^- QID: OQ-SIG-[0-9]{3}' \
--null-if-missing
# Count risks by severity
bash .claude/scripts/demoswarm.sh count pattern \
--file ".runs/feat-auth/signal/early_risks.md" \
--regex '^- RSK-[0-9]+ \[CRITICAL\]' \
--null-if-missingExtracting Machine Summary fields
# Get status from critic
bash .claude/scripts/demoswarm.sh ms get \
--file ".runs/feat-auth/signal/requirements_critique.md" \
--section "## Machine Summary" \
--key "status" \
--null-if-missing
# stdout: VERIFIED (or null)
# Get recommended_action
bash .claude/scripts/demoswarm.sh ms get \
--file ".runs/feat-auth/build/code_critique.md" \
--section "## Machine Summary" \
--key "recommended_action" \
--null-if-missingReading receipt fields
# Read merge verdict from gate receipt
bash .claude/scripts/demoswarm.sh receipt get \
--file ".runs/feat-auth/gate/gate_receipt.json" \
--key "merge_verdict" \
--null-if-missing
# stdout: MERGE (or null)
# Read prior flow status
bash .claude/scripts/demoswarm.sh receipt get \
--file ".runs/feat-auth/plan/plan_receipt.json" \
--key "status" \
--null-if-missingExtracting YAML block fields
# Get deployment verdict
bash .claude/scripts/demoswarm.sh yaml get \
--file ".runs/feat-auth/deploy/deployment_decision.md" \
--key "deployment_verdict" \
--null-if-missing
# stdout: STABLE (or null)
# Get Gate Result status from merge decision
bash .claude/scripts/demoswarm.sh yaml get \
--file ".runs/feat-auth/gate/merge_decision.md" \
--key "status" \
--null-if-missingCounting items in YAML blocks
# Count blockers array length
bash .claude/scripts/demoswarm.sh yaml count-items \
--file ".runs/feat-auth/gate/merge_decision.md" \
--item-regex '^[[:space:]]*- check:' \
--null-if-missingTimestamp generation
bash .claude/scripts/demoswarm.sh time now
# stdout: 2025-12-12T10:30:00ZContract Rules
- stdout: Always a single scalar (
null, integer, or string) - exit code: Always
0(errors expressed vianullstdout) - stderr: Optional diagnostics (never required for parsing)
- null semantics: Missing file →
null, no matches →0 - template leak guard: Values containing
|or<→null
For Agent Authors
When writing cleanup agents:
- Use
runs-derive—bash .claude/scripts/demoswarm.sh ... - Do not embed
grep|sed|awk|jqpipelines — use shim commands - Trust the contract — helpers handle edge cases consistently
- Add blockers for nulls — when a count is null, explain why
Example pattern:
REQ_COUNT=$(bash .claude/scripts/demoswarm.sh count pattern \
--file ".runs/${RUN_ID}/signal/requirements.md" \
--regex '^### REQ-' \
--null-if-missing)
if [[ "$REQ_COUNT" == "null" ]]; then
BLOCKERS+=("requirements.md missing or unparseable")
fiInstallation
The Rust implementation is preferred. Install to repo-local directory:
cargo install --path tools/demoswarm-runs-tools --root .demoswarmThe shim will automatically resolve in order:
.demoswarm/bin/demoswarm(repo-local install, preferred)demoswarmon PATH (global install)cargo runfallback (dev environments)- Python fallback (legacy)
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

