feat: bash setup script, planner agent with disallowedTools, simplified skills

This commit is contained in:
2026-03-27 09:23:42 -04:00
parent 53086c9dbc
commit 86b2b7271b
4 changed files with 275 additions and 197 deletions

View File

@@ -1,102 +1,35 @@
---
name: init
description: "Infrastructure setup: scaffold .loop/ directory with harness files and generate config.json. Does NOT plan or write code."
description: "Run the setup script to scaffold .loop/ directory. Does not plan features or write code."
---
# /init — Scaffold the Agent Loop
Create the `.loop/` directory and generate `config.json`. That's it. This skill does NOT plan features, generate stories, or write any project source code.
Run the setup script to create `.loop/` with harness files and config. This skill does ONE thing: run a bash command.
## STOP: What This Skill Does NOT Do
## Instructions
- Does NOT read or use any spec files
- Does NOT generate prd.json or stories
- Does NOT write any source code
- Does NOT invoke /agent-loop:plan
- Does NOT start the loop
1. Ask the user: **Mode?** (a) Implement (b) Explore (c) Fix — default is Implement.
## Steps
### 1. Check if .loop/ already exists
If yes, ask: "`.loop/` already exists. Re-initialize? (This resets config but keeps prd.json and progress.md)"
If they say no, stop.
### 2. Copy harness files
Run these commands:
2. Run the setup script:
```bash
mkdir -p .loop
# Find plugin harness source
HARNESS_SRC=$(ls -d ~/.claude/plugins/cache/agent-loop/agent-loop/*/prompts/.. 2>/dev/null | head -1)
if [ -n "$HARNESS_SRC" ]; then
cp -r "$HARNESS_SRC/prompts" .loop/
cp -r "$HARNESS_SRC/templates" .loop/
cp -r "$HARNESS_SRC/lib" .loop/
cp "$HARNESS_SRC/loop.sh" .loop/
chmod +x .loop/loop.sh
else
echo "ERROR: Could not find agent-loop plugin files"
fi
bash ~/.claude/plugins/cache/agent-loop/agent-loop/*/setup.sh <mode>
```
Verify `.loop/prompts/generator/_base.md` exists. If not, report the error and stop.
If that path doesn't work, try:
### 3. Create .loop/.gitignore
```
prd.json
progress.md
progress-archive.md
config.json
init.sh
contracts/
triage/
archive/
.archive-staging/
.last-branch
.loop.lock
```bash
bash "$(ls -d ~/.claude/plugins/cache/agent-loop/agent-loop/*/setup.sh 2>/dev/null | head -1)" <mode>
```
### 4. Detect project and generate config
3. Show the script output to the user.
Read the project root to detect tech stack (package.json, go.mod, Cargo.toml, etc.).
4. Tell the user:
Ask the user:
> **Mode?** (a) Explore (b) Implement (c) Fix
Write `.loop/config.json`:
```json
{
"tool": "claude",
"mode": "<implement|explore|fix>",
"maxIterations": 20,
"skipEval": false,
"evalRetries": 2,
"autoHooks": true,
"branchPrefix": "loop/",
"scopeBudgets": {
"explore": { "maxFilesToRead": 15, "maxLinesToWrite": 0, "maxFilesToModify": 0 },
"implement": { "maxFilesToRead": 50, "maxLinesToWrite": 500, "maxFilesToModify": 10 },
"fix": { "maxFilesToRead": 30, "maxLinesToWrite": 200, "maxFilesToModify": 5 }
}
}
```
### 5. Generate init.sh
Write `.loop/init.sh` with project-specific setup (dependency install, dev server, test runner). Make it executable.
### 6. Done
Tell the user:
> `.loop/` is ready. Next steps:
> `.loop/` is ready. Next:
> ```
> /agent-loop:plan # Generate stories from your spec or feature description
> /agent-loop:plan
> ```
**That's it. Do not do anything else. Do not read specs. Do not plan. Do not write code.**

View File

@@ -1,154 +1,63 @@
---
name: plan
description: "Generate prd.json and sprint contracts from a spec or feature description. Requires .loop/ directory. Does NOT write source code or start the loop."
description: "Generate prd.json and sprint contracts by dispatching the planner agent. Does not write source code."
---
# /plan — Generate PRD and Sprint Contracts
Read a spec or feature description, decompose it into stories, and write `.loop/prd.json` and `.loop/contracts/`. This skill does NOT write any project source code or start the loop.
Dispatch the planner agent to decompose a spec into stories. The planner agent cannot write source code or run bash commands — it can only write to `.loop/`.
## STOP: What This Skill Does NOT Do
## Instructions
- Does NOT write any project source code (no .js, .py, .ts, .html, .css, etc.)
- Does NOT start the loop or invoke /agent-loop:run
- Does NOT make git commits to project code
### 1. Check prerequisites
## Prerequisites
Verify `.loop/config.json` exists. If not, tell the user to run `/agent-loop:init` first and stop.
`.loop/config.json` must exist. If not, tell the user to run `/agent-loop:init` first and stop.
### 2. Find the spec
## Steps
### 1. Find the feature spec or description
Check these locations for an existing spec:
Check these locations:
- `docs/superpowers/specs/*.md`
- `docs/specs/*.md`
- `SPEC.md`, `PRD.md`, `DESIGN.md` at project root
If found: "I found a spec at `{path}`. Using it."
If found, read the spec content.
If not found, check if the user passed a description as an argument. If nothing: ask "What do you want to build? 1-3 sentences."
If not found, ask: "What do you want to build? 1-3 sentences." Use their answer as the spec.
### 2. Analyze the project
### 3. Read project context
- Read relevant source directories
- Check for existing tests and conventions
- Run `git log --oneline -20` if git history exists
Read the project root listing and any key config files (package.json, etc.) to understand the tech stack. Read `.loop/config.json` for the mode.
### 3. Ask 2-3 clarifying questions
### 4. Dispatch planner agent
Only questions where human judgment is needed. Do NOT ask what you can answer from the code or spec.
Use the Agent tool to launch the `agent-loop:planner` agent:
### 4. Generate prd.json
**CRITICAL: Use this EXACT schema. The loop orchestrator will break if you deviate.**
Write `.loop/prd.json`:
```json
{
"project": "<project name>",
"branchName": "loop/<feature-slug>",
"description": "<one-line description>",
"userStories": [
{
"id": "US-001",
"title": "Short descriptive title",
"description": "What this story delivers",
"acceptanceCriteria": [
"Specific, verifiable criterion",
"Another criterion"
],
"priority": 1,
"passes": false,
"notes": "",
"rejections": 0
}
]
}
```
Agent(
subagent_type: "agent-loop:planner",
prompt: "Generate prd.json and sprint contracts for this project.\n\nMode: {mode}\nProject root: {path}\n\nSpec:\n{spec content}\n\nProject tech stack: {detected stack}",
description: "Planning: generate stories"
)
```
**Rules:**
- Top-level array key MUST be `userStories`. Not `sprints`, `stories`, or `tasks`.
- IDs: `US-001`, `US-002`, etc.
- `passes`: always `false`. `notes`: always `""`. `rejections`: always `0`.
- Each priority is unique (1 = highest).
- Each story fits in one agent context window (1-3 files changed).
- Acceptance criteria must be independently verifiable — not "works well" but "returns X when given Y".
### 5. Present results
### 5. Generate sprint contracts
Create `.loop/contracts/` directory. For each story, write `.loop/contracts/{id}.contract.md`:
```markdown
# Sprint Contract: {id} — {title}
## What Will Be Built
Concrete deliverable description.
## Done Conditions
- [ ] Specific testable condition
- [ ] All acceptance criteria from prd.json met
## Evaluation Criteria
- [ ] What the evaluator checks
- [ ] No regressions
## Out of Scope
- Things NOT in this story
## Key Files
- path/to/file — what changes
## Dependencies
- Depends on: [IDs or "none"]
- Blocks: [IDs or "none"]
```
### 6. Initialize progress.md
Write `.loop/progress.md`:
```markdown
# Progress
## Codebase Patterns
- [Patterns from analysis]
---
## Session Log
### Planning Session
Date: {today}
**PRD created:** {N} stories for "{description}"
---
```
### 7. Present for review
After the planner finishes, read `.loop/prd.json` and show the user:
> **Plan Ready — Review Before Running**
>
> | Stories | Mode | Branch |
> |---------|------|--------|
> | {N} | {mode} | {branchName} |
>
> **Stories:**
> 1. US-001: {title}
> 2. US-002: {title}
> ...
>
> **Review before running:**
> **Review:**
> - `.loop/prd.json` — stories and acceptance criteria
> - `.loop/contracts/` — done conditions per story
>
> When ready:
> Adjust anything, then:
> ```
> /agent-loop:run
> ```
**STOP HERE. Do NOT start the loop. Wait for the user to run /agent-loop:run explicitly.**
**STOP. Do not start the loop. Do not write source code.**