create-agent-room 1.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +229 -0
- package/bin/cli.js +186 -0
- package/examples/python-project/.agent-room.json +14 -0
- package/examples/python-project/AGENTS.md +32 -0
- package/examples/rust-project/.agent-room.json +12 -0
- package/examples/rust-project/AGENTS.md +32 -0
- package/lib/color.js +31 -0
- package/lib/fsutil.js +218 -0
- package/lib/init.js +660 -0
- package/lib/lint-sessions.js +278 -0
- package/lib/metrics.js +190 -0
- package/lib/pr.js +176 -0
- package/lib/prompt.js +20 -0
- package/lib/session-utils.js +213 -0
- package/lib/sync.js +138 -0
- package/lib/validate.js +179 -0
- package/package.json +48 -0
- package/templates/.agent-room/anti-patterns.md +22 -0
- package/templates/.agent-room/coordination/handoff-protocol.md +60 -0
- package/templates/.agent-room/coordination/scope-boundaries.md +57 -0
- package/templates/.agent-room/coordination/session-log-format.md +62 -0
- package/templates/.agent-room/decisions.md +17 -0
- package/templates/.agent-room/guardrails.json +23 -0
- package/templates/.agent-room/guardrails.md +56 -0
- package/templates/.agent-room/principles.md +306 -0
- package/templates/.agent-room/sessions/.gitkeep +4 -0
- package/templates/.agent-room/skills/brainstorming.md +64 -0
- package/templates/.agent-room/skills/closing-the-loop.md +67 -0
- package/templates/.agent-room/skills/systematic-debugging.md +85 -0
- package/templates/.agent-room/skills/test-driven-development.md +100 -0
- package/templates/.agent-room/skills/verification-before-completion.md +56 -0
- package/templates/.agent-room/skills/writing-plans.md +87 -0
- package/templates/.agent-room/workflow-classifier.md +127 -0
- package/templates/AGENTS.md.tmpl +85 -0
- package/templates/adapters/CLAUDE.md.tmpl +38 -0
- package/templates/adapters/claude-hooks/close-the-loop-check.js +96 -0
- package/templates/adapters/clinerules.tmpl +14 -0
- package/templates/adapters/codexrules.tmpl +45 -0
- package/templates/adapters/cursorrules.tmpl +14 -0
- package/templates/adapters/git-hooks/guardrails-check.js +140 -0
- package/templates/adapters/git-hooks/pre-commit.tmpl +43 -0
- package/templates/adapters/windsurfrules.tmpl +14 -0
- package/templates/docs/plans/.gitkeep +0 -0
- package/templates/skill-packs/api-design/api-design.md +152 -0
- package/templates/skill-packs/code-review/code-review.md +113 -0
- package/templates/skill-packs/database/database-migrations.md +123 -0
- package/templates/skill-packs/documentation/documentation.md +155 -0
- package/templates/skill-packs/observability/observability.md +128 -0
- package/templates/skill-packs/performance/performance-optimization.md +150 -0
- package/templates/skill-packs/release/release-management.md +145 -0
- package/templates/skill-packs/security/security-principles.md +127 -0
- package/templates/skill-packs/testing/integration-testing.md +127 -0
- package/templates/stacks/python/.agent-room/skills/python-testing.md +59 -0
- package/templates/stacks/python/AGENTS.md.tmpl +35 -0
- package/templates/stacks/react/.agent-room/skills/react-component-testing.md +76 -0
- package/templates/stacks/react/AGENTS.md.tmpl +37 -0
- package/templates/stacks/typescript/.agent-room/skills/typescript-testing.md +63 -0
- package/templates/stacks/typescript/AGENTS.md.tmpl +36 -0
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
# Agent Scope Boundaries
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
When multiple agents (or humans and agents) work in the same repository
|
|
6
|
+
simultaneously, conflicts are inevitable unless scope boundaries are
|
|
7
|
+
established. This protocol defines how to partition work to avoid
|
|
8
|
+
stepping on toes.
|
|
9
|
+
|
|
10
|
+
## The iron law
|
|
11
|
+
|
|
12
|
+
```
|
|
13
|
+
NEVER MODIFY FILES OUTSIDE YOUR ASSIGNED SCOPE WITHOUT EXPLICIT COORDINATION
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
If your task is to update the billing module, and you notice a typo in
|
|
17
|
+
the authentication module, do not fix it in the same PR. Scope creep
|
|
18
|
+
causes merge conflicts and blocks parallel work.
|
|
19
|
+
|
|
20
|
+
## Conflict avoidance
|
|
21
|
+
|
|
22
|
+
### 1. File-level ownership
|
|
23
|
+
|
|
24
|
+
During a task, treat the files you are actively modifying as "owned" by
|
|
25
|
+
your session. Before modifying a shared file (like a main router, a
|
|
26
|
+
root configuration file, or `package.json`), check if another session
|
|
27
|
+
might be touching it.
|
|
28
|
+
|
|
29
|
+
### 2. Lock semantics for shared resources
|
|
30
|
+
|
|
31
|
+
Certain operations inherently block parallel work:
|
|
32
|
+
|
|
33
|
+
- **Database migrations:** Do not create a new migration if another
|
|
34
|
+
agent is currently building one. Coordinate to ensure sequential
|
|
35
|
+
migration numbering/timestamping.
|
|
36
|
+
- **Dependency updates:** Do not bump a major dependency while another
|
|
37
|
+
feature branch is in progress, unless coordinated.
|
|
38
|
+
|
|
39
|
+
### 3. Detect conflicts early
|
|
40
|
+
|
|
41
|
+
Before starting a new feature branch, or before modifying a highly
|
|
42
|
+
contested file:
|
|
43
|
+
|
|
44
|
+
1. Run `git fetch` and `git status`.
|
|
45
|
+
2. Check for open PRs that might touch the same files.
|
|
46
|
+
3. If a conflict is highly likely, communicate the overlap before
|
|
47
|
+
writing code.
|
|
48
|
+
|
|
49
|
+
## Handling out-of-scope discoveries
|
|
50
|
+
|
|
51
|
+
When you discover an issue outside your current scope (e.g., a bug in a
|
|
52
|
+
utility function, a missing test in another module):
|
|
53
|
+
|
|
54
|
+
1. **Do not fix it immediately** (unless it directly blocks your work).
|
|
55
|
+
2. **Document it.** Write it down in a tracking issue, a TODO comment,
|
|
56
|
+
or notify the user.
|
|
57
|
+
3. **Stay focused.** Finish your assigned task first.
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
# Session Log Format
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
Session logs provide observability into what agents are doing, how long
|
|
6
|
+
they take, and what decisions they make. This is crucial for debugging
|
|
7
|
+
agent failures and for team visibility.
|
|
8
|
+
|
|
9
|
+
## Storage location
|
|
10
|
+
|
|
11
|
+
Logs should be saved in `.agent-room/sessions/` using the following
|
|
12
|
+
naming convention:
|
|
13
|
+
|
|
14
|
+
`YYYY-MM-DD-HH-MM-<topic>.md`
|
|
15
|
+
|
|
16
|
+
Example: `2025-03-15-14-30-fix-login-timeout.md`
|
|
17
|
+
|
|
18
|
+
## Log format
|
|
19
|
+
|
|
20
|
+
Every session log must follow this structure:
|
|
21
|
+
|
|
22
|
+
```markdown
|
|
23
|
+
# Session Log: [Short title]
|
|
24
|
+
|
|
25
|
+
**Date:** YYYY-MM-DD HH:MM
|
|
26
|
+
**Agent:** [Name/Version of the agent, e.g., Claude 3.5 Sonnet]
|
|
27
|
+
**Classification:** [Bug | Enhancement | Feature | Product]
|
|
28
|
+
|
|
29
|
+
## Goal
|
|
30
|
+
[One sentence describing what the session aimed to achieve]
|
|
31
|
+
|
|
32
|
+
## Files touched
|
|
33
|
+
- Read: [list of key files read for context]
|
|
34
|
+
- Created: [list of new files]
|
|
35
|
+
- Modified: [list of modified files]
|
|
36
|
+
|
|
37
|
+
## Actions taken
|
|
38
|
+
1. [Step 1: e.g., Ran grep to find login timeout config]
|
|
39
|
+
2. [Step 2: e.g., Wrote failing test in auth.test.js]
|
|
40
|
+
3. [Step 3: e.g., Updated timeout value and passed test]
|
|
41
|
+
|
|
42
|
+
## Tests run
|
|
43
|
+
- Command: `npm test`
|
|
44
|
+
- Result: [Pass | Fail | 2 errors]
|
|
45
|
+
|
|
46
|
+
## Decisions made
|
|
47
|
+
- [Any non-obvious architecture or design calls made during the session.
|
|
48
|
+
These should also be appended to .agent-room/decisions.md]
|
|
49
|
+
|
|
50
|
+
## Outcome
|
|
51
|
+
[Completed | Blocked | Handed Off]
|
|
52
|
+
|
|
53
|
+
**Handoff note (if applicable):**
|
|
54
|
+
[Insert the handoff note here, following handoff-protocol.md]
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## When to write a session log
|
|
58
|
+
|
|
59
|
+
- **Opt-in:** Depending on the project's `.agent-room.json` config,
|
|
60
|
+
session logging may be required or optional.
|
|
61
|
+
- **Default:** Write a log at the end of any session that lasted more
|
|
62
|
+
than 15 minutes or resulted in a non-trivial code change.
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# Decisions Log — {{PROJECT_NAME}}
|
|
2
|
+
|
|
3
|
+
Short, append-only record of architecture/design decisions and why. A
|
|
4
|
+
decision belongs here if a future session (or a future you) would otherwise
|
|
5
|
+
have to re-derive it from scratch by reading git history.
|
|
6
|
+
|
|
7
|
+
## Format
|
|
8
|
+
|
|
9
|
+
```
|
|
10
|
+
### YYYY-MM-DD — short title
|
|
11
|
+
|
|
12
|
+
**Decision:** what was decided.
|
|
13
|
+
**Why:** the constraint or trade-off that drove it.
|
|
14
|
+
**Rejected:** what else was considered, and why it lost.
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
<!-- Entries go below this line, newest first. -->
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
{
|
|
2
|
+
"protectedPaths": [
|
|
3
|
+
"infrastructure/**",
|
|
4
|
+
"**/*.tfstate",
|
|
5
|
+
".github/workflows/**"
|
|
6
|
+
],
|
|
7
|
+
"requireApprovalFor": [
|
|
8
|
+
"database migrations",
|
|
9
|
+
"dependency major version bumps",
|
|
10
|
+
"changes to CI/CD pipeline",
|
|
11
|
+
"changes to authentication or authorization logic"
|
|
12
|
+
],
|
|
13
|
+
"scopeGuidance": {
|
|
14
|
+
"maxFilesPerChange": 20,
|
|
15
|
+
"maxLinesPerChange": 500
|
|
16
|
+
},
|
|
17
|
+
"forbiddenActions": [
|
|
18
|
+
"deploy to production",
|
|
19
|
+
"delete database tables in production",
|
|
20
|
+
"modify authentication middleware without security review",
|
|
21
|
+
"commit secrets, API keys, or credentials"
|
|
22
|
+
]
|
|
23
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
# Agent Guardrails — {{PROJECT_NAME}}
|
|
2
|
+
|
|
3
|
+
Boundaries and constraints for AI agents working in this codebase. Read
|
|
4
|
+
this file before making changes to protected areas. When in doubt, ask
|
|
5
|
+
the maintainer rather than proceeding.
|
|
6
|
+
|
|
7
|
+
## Protected paths
|
|
8
|
+
|
|
9
|
+
Files and directories that agents must not modify without explicit
|
|
10
|
+
approval from the project maintainer:
|
|
11
|
+
|
|
12
|
+
<!-- Add paths that require human review before agent modification.
|
|
13
|
+
Examples: infrastructure/, *.tfstate, docker-compose.prod.yml,
|
|
14
|
+
.github/workflows/, database/migrations/ -->
|
|
15
|
+
|
|
16
|
+
## Approval requirements
|
|
17
|
+
|
|
18
|
+
Changes that require human review, even if technically possible:
|
|
19
|
+
|
|
20
|
+
- Database migrations (schema changes, data backfills)
|
|
21
|
+
- Dependency major version bumps
|
|
22
|
+
- Changes to CI/CD pipeline configuration
|
|
23
|
+
- Changes to authentication or authorization logic
|
|
24
|
+
- Modifications to production deployment configuration
|
|
25
|
+
|
|
26
|
+
## Scope guidance
|
|
27
|
+
|
|
28
|
+
Keep individual changes focused and reviewable:
|
|
29
|
+
|
|
30
|
+
- **Aim for:** single-purpose PRs, one concern per change
|
|
31
|
+
- **Watch for:** PRs touching more than 15-20 files, changes exceeding
|
|
32
|
+
~500 lines of new code, or changes that mix refactoring with new features
|
|
33
|
+
- These are guidelines, not hard limits — a migration touching 30 files
|
|
34
|
+
may be appropriate, but it deserves extra scrutiny
|
|
35
|
+
|
|
36
|
+
## Forbidden actions
|
|
37
|
+
|
|
38
|
+
Actions agents must never take, regardless of context:
|
|
39
|
+
|
|
40
|
+
- Deploy to production without human approval
|
|
41
|
+
- Delete database tables or collections in production
|
|
42
|
+
- Modify authentication middleware without security review
|
|
43
|
+
- Commit secrets, API keys, or credentials to the repository
|
|
44
|
+
- Disable or skip tests to make a build pass
|
|
45
|
+
- Suppress security audit warnings without documenting why
|
|
46
|
+
|
|
47
|
+
## How to use this file
|
|
48
|
+
|
|
49
|
+
1. **Before starting work:** Scan the change against protected paths. If
|
|
50
|
+
the change touches a protected area, ask the maintainer for approval.
|
|
51
|
+
2. **During work:** Check scope guidance. If the change is growing beyond
|
|
52
|
+
the guidelines, consider splitting it.
|
|
53
|
+
3. **Before finishing:** Verify none of the forbidden actions were taken.
|
|
54
|
+
|
|
55
|
+
For machine-readable guardrails that CI and tooling can enforce, see
|
|
56
|
+
`.agent-room/guardrails.json`.
|
|
@@ -0,0 +1,306 @@
|
|
|
1
|
+
# LLM-Native Development Principles
|
|
2
|
+
|
|
3
|
+
A working reference for getting predictable outcomes out of an LLM coding
|
|
4
|
+
agent. The point is not to sound clever — it's to make outcomes predictable.
|
|
5
|
+
|
|
6
|
+
## Quick reference
|
|
7
|
+
|
|
8
|
+
| # | Principle | Default move |
|
|
9
|
+
| --- | --- | --- |
|
|
10
|
+
| 1 | LLMs are retrieval systems | Use precise names, types, constraints, and input context |
|
|
11
|
+
| 2 | Iteration is required | Explore, constrain, refine, verify — don't one-shot |
|
|
12
|
+
| 3 | Context windows forget | Write summary checkpoints to files, not just chat |
|
|
13
|
+
| 4 | Explanation pressure finds weak spots | Ask it to explain, challenge, and restate the work |
|
|
14
|
+
| 5 | Negative knowledge is leverage | Keep an anti-patterns file; one avoided bug beats one good example |
|
|
15
|
+
| 6 | Tests are the spec | Write the test before the implementation |
|
|
16
|
+
| 7 | Specific names retrieve better | Prefer clear, specific, stable names over short or sprawling ones |
|
|
17
|
+
| 8 | Match process to work type | Use the lightest process that still protects quality |
|
|
18
|
+
| 9 | PRD and architecture co-evolve | Let architecture discoveries simplify the requirements |
|
|
19
|
+
| 10 | Serialize state | A checkpoint should let someone else resume without guesswork |
|
|
20
|
+
| 11 | Delegate with rules, not vibes | Can I define correctness right now? Yes: proceed. Missing facts: research. Unclear requirement: escalate. |
|
|
21
|
+
| 12 | Close the loop | Record failures and wins; feed both back into future prompts |
|
|
22
|
+
|
|
23
|
+
## How they connect
|
|
24
|
+
|
|
25
|
+
```
|
|
26
|
+
[Foundation] -> [Quality] -> [Process]
|
|
27
|
+
^ |
|
|
28
|
+
| |
|
|
29
|
+
+-------- learning ---------+
|
|
30
|
+
|
|
31
|
+
Foundation = model behavior (1-5)
|
|
32
|
+
Quality = output quality (6-7)
|
|
33
|
+
Process = safe delivery (8-11)
|
|
34
|
+
Learning = feeds back in (12)
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
---
|
|
38
|
+
|
|
39
|
+
## Principle 1: LLMs Are Retrieval Systems
|
|
40
|
+
|
|
41
|
+
**Rule:** Output quality depends on input context quality more than on
|
|
42
|
+
"prompting skill." Fix the input, not the model.
|
|
43
|
+
|
|
44
|
+
**Violation:** You ask an agent to "add caching." It invents a custom
|
|
45
|
+
in-memory cache using a plain object, ignoring the Redis client already
|
|
46
|
+
configured in `lib/cache.ts`, because nothing in the prompt mentioned
|
|
47
|
+
existing infrastructure. The resulting PR duplicates functionality and
|
|
48
|
+
introduces a cache invalidation bug.
|
|
49
|
+
|
|
50
|
+
**Compliance:** You tell the agent: "Add response caching to the
|
|
51
|
+
`/api/users` endpoint. The project uses Redis via `lib/cache.ts` — read
|
|
52
|
+
that file first. Cache keys should follow the `resource:id:action` pattern
|
|
53
|
+
established in `lib/cache.ts:L14-L22`. TTL: 5 minutes." The agent retrieves
|
|
54
|
+
the right pattern and extends it.
|
|
55
|
+
|
|
56
|
+
**Related:** `systematic-debugging.md` Phase 2 (pattern analysis relies on
|
|
57
|
+
giving the model the right reference), `brainstorming.md` (context
|
|
58
|
+
exploration step).
|
|
59
|
+
|
|
60
|
+
---
|
|
61
|
+
|
|
62
|
+
## Principle 2: Iteration Is Required
|
|
63
|
+
|
|
64
|
+
**Rule:** Explore, constrain, refine, verify. Don't one-shot. The first
|
|
65
|
+
answer is a draft, not a deliverable.
|
|
66
|
+
|
|
67
|
+
**Violation:** You accept the agent's first-pass database schema without
|
|
68
|
+
reviewing it. It normalizes aggressively, creating 7 join tables for what
|
|
69
|
+
could be 3 tables with a JSONB column. The query complexity compounds
|
|
70
|
+
through the entire codebase before anyone notices.
|
|
71
|
+
|
|
72
|
+
**Compliance:** You ask the agent to propose 2-3 schema approaches, state
|
|
73
|
+
the read/write ratio, then pick one. After the first implementation pass,
|
|
74
|
+
you ask "what are the three most likely failure modes for this schema under
|
|
75
|
+
10x current load?" and refine before committing.
|
|
76
|
+
|
|
77
|
+
**Related:** `brainstorming.md` (proposes alternatives before committing),
|
|
78
|
+
`writing-plans.md` (breaks work into iterable steps).
|
|
79
|
+
|
|
80
|
+
---
|
|
81
|
+
|
|
82
|
+
## Principle 3: Context Windows Forget
|
|
83
|
+
|
|
84
|
+
**Rule:** Write summary checkpoints to files, not just chat. A decision
|
|
85
|
+
that only lives in a chat message is a decision that will be re-derived
|
|
86
|
+
from scratch in the next session.
|
|
87
|
+
|
|
88
|
+
**Violation:** Over a 90-minute session, you and the agent agree to use
|
|
89
|
+
event sourcing for the audit log, reject CQRS as overkill, and decide on
|
|
90
|
+
a 30-day retention policy. None of this is written down. The next session
|
|
91
|
+
starts fresh and proposes CQRS for the audit log.
|
|
92
|
+
|
|
93
|
+
**Compliance:** After each significant decision, you checkpoint to
|
|
94
|
+
`.agent-room/decisions.md`: "Chose event sourcing over CQRS for audit.
|
|
95
|
+
Retention: 30 days. Rationale: read load is low, write-append is the
|
|
96
|
+
dominant pattern." The next session reads decisions.md first.
|
|
97
|
+
|
|
98
|
+
**Related:** `closing-the-loop.md` (enforces the checkpoint habit),
|
|
99
|
+
`decisions.md` (the storage format).
|
|
100
|
+
|
|
101
|
+
---
|
|
102
|
+
|
|
103
|
+
## Principle 4: Explanation Pressure Finds Weak Spots
|
|
104
|
+
|
|
105
|
+
**Rule:** Ask "explain why" and "what could fail" before shipping. Claims
|
|
106
|
+
the model can't justify are claims it shouldn't make.
|
|
107
|
+
|
|
108
|
+
**Violation:** The agent produces a retry mechanism with exponential
|
|
109
|
+
backoff. You say "looks good" and ship. In production, the retry loop
|
|
110
|
+
has no jitter, causing thundering herd failures during partial outages
|
|
111
|
+
because all retries hit the same millisecond.
|
|
112
|
+
|
|
113
|
+
**Compliance:** You ask: "Walk me through what happens when 1,000
|
|
114
|
+
concurrent requests all fail at the same time and all start retrying." The
|
|
115
|
+
agent discovers the jitter gap itself and adds randomized delay before you
|
|
116
|
+
have to file the production incident.
|
|
117
|
+
|
|
118
|
+
**Related:** `verification-before-completion.md` (evidence before claims),
|
|
119
|
+
`brainstorming.md` (questioning step).
|
|
120
|
+
|
|
121
|
+
---
|
|
122
|
+
|
|
123
|
+
## Principle 5: Negative Knowledge Is Leverage
|
|
124
|
+
|
|
125
|
+
**Rule:** One avoided mistake is worth more than one polished example. Keep
|
|
126
|
+
an anti-patterns file; make the agent read it before every session.
|
|
127
|
+
|
|
128
|
+
**Violation:** The agent fixes a timezone bug by converting to UTC at the
|
|
129
|
+
API boundary. Two weeks later, a different session encounters the same
|
|
130
|
+
class of bug in reporting and tries local-time comparison first — because
|
|
131
|
+
nobody wrote down the root cause.
|
|
132
|
+
|
|
133
|
+
**Compliance:** After fixing the timezone bug, the agent appends to
|
|
134
|
+
`anti-patterns.md`: "Date comparisons must use UTC. Local time caused
|
|
135
|
+
silent data corruption in reporting. Rule: all datetime comparisons
|
|
136
|
+
normalized to UTC before comparison." The next session reads this entry
|
|
137
|
+
and avoids the trap entirely.
|
|
138
|
+
|
|
139
|
+
**Related:** `closing-the-loop.md` (the enforcement mechanism),
|
|
140
|
+
`anti-patterns.md` (the storage format), `systematic-debugging.md`
|
|
141
|
+
(root cause investigation feeds anti-patterns).
|
|
142
|
+
|
|
143
|
+
---
|
|
144
|
+
|
|
145
|
+
## Principle 6: Tests Are the Spec
|
|
146
|
+
|
|
147
|
+
**Rule:** Write the test before the implementation. If the test didn't
|
|
148
|
+
fail first, you don't know if it tests the right thing.
|
|
149
|
+
|
|
150
|
+
**Violation:** The agent writes a user registration endpoint, then writes
|
|
151
|
+
tests that assert exactly what the code does — including a bug where
|
|
152
|
+
duplicate emails return 200 instead of 409. The test passes, the bug
|
|
153
|
+
ships, and the test provides false confidence.
|
|
154
|
+
|
|
155
|
+
**Compliance:** The agent writes the test first: `POST /register with an
|
|
156
|
+
already-registered email should return 409 Conflict`. The test fails
|
|
157
|
+
(no implementation yet). The agent writes the handler, the test passes.
|
|
158
|
+
The spec drove the code, not the other way around.
|
|
159
|
+
|
|
160
|
+
**Related:** `test-driven-development.md` (full TDD process),
|
|
161
|
+
`systematic-debugging.md` Phase 4 (regression test before fix).
|
|
162
|
+
|
|
163
|
+
---
|
|
164
|
+
|
|
165
|
+
## Principle 7: Specific Names Retrieve Better
|
|
166
|
+
|
|
167
|
+
**Rule:** Prefer clear, specific, stable names over short or sprawling
|
|
168
|
+
ones. The model retrieves patterns based on naming — vague names retrieve
|
|
169
|
+
vague patterns.
|
|
170
|
+
|
|
171
|
+
**Violation:** A module is named `utils.js`. It grows to 400 lines
|
|
172
|
+
containing date formatting, string sanitization, and HTTP helpers. The
|
|
173
|
+
agent asked to "add a utility function" dumps yet another unrelated
|
|
174
|
+
function into the file because the name invites everything.
|
|
175
|
+
|
|
176
|
+
**Compliance:** The module is split into `date-format.js`,
|
|
177
|
+
`string-sanitize.js`, and `http-helpers.js`. When the agent is asked to
|
|
178
|
+
add date formatting, it finds and extends `date-format.js` without
|
|
179
|
+
touching unrelated code. Retrieval matches intent.
|
|
180
|
+
|
|
181
|
+
**Related:** `brainstorming.md` (naming is a design decision worth
|
|
182
|
+
discussing), `writing-plans.md` (exact file paths in every task).
|
|
183
|
+
|
|
184
|
+
---
|
|
185
|
+
|
|
186
|
+
## Principle 8: Match Process to Work Type
|
|
187
|
+
|
|
188
|
+
**Rule:** Use the lightest process that still protects quality.
|
|
189
|
+
Over-process wastes time; under-process builds the wrong thing.
|
|
190
|
+
|
|
191
|
+
**Violation:** A one-line typo fix goes through a full design review,
|
|
192
|
+
PRD, architecture doc, and TDD cycle. Or: a new authentication system is
|
|
193
|
+
built without any design discussion because "we'll figure it out as we
|
|
194
|
+
code."
|
|
195
|
+
|
|
196
|
+
**Compliance:** The typo fix is classified as Bug → fixed, regression
|
|
197
|
+
test, done in hours. The auth system is classified as Feature → full
|
|
198
|
+
brainstorm, design doc, architecture review, TDD, done in weeks. The
|
|
199
|
+
process matches the risk.
|
|
200
|
+
|
|
201
|
+
**Related:** `workflow-classifier.md` (the classification system),
|
|
202
|
+
`brainstorming.md` (invoked for Features and Products, not Bugs).
|
|
203
|
+
|
|
204
|
+
---
|
|
205
|
+
|
|
206
|
+
## Principle 9: PRD and Architecture Co-Evolve
|
|
207
|
+
|
|
208
|
+
**Rule:** Let architecture discoveries simplify the requirements. Don't
|
|
209
|
+
treat the first draft of requirements as sacred — the best designs emerge
|
|
210
|
+
when requirements and architecture inform each other.
|
|
211
|
+
|
|
212
|
+
**Violation:** The PRD demands real-time collaborative editing. The team
|
|
213
|
+
implements CRDTs. Mid-implementation, they discover the actual use case is
|
|
214
|
+
"two people occasionally edit the same document" — last-write-wins with
|
|
215
|
+
conflict detection would have been 90% simpler. But the PRD said
|
|
216
|
+
"real-time collaborative editing" so nobody questioned it.
|
|
217
|
+
|
|
218
|
+
**Compliance:** During architecture exploration, the agent asks: "The PRD
|
|
219
|
+
says real-time collaboration. What's the expected concurrent-editor count?
|
|
220
|
+
If it's typically 1-2, last-write-wins with conflict UI is dramatically
|
|
221
|
+
simpler." The PRD is updated to reflect the simpler requirement.
|
|
222
|
+
|
|
223
|
+
**Related:** `brainstorming.md` (propose alternatives), `writing-plans.md`
|
|
224
|
+
(architecture section in plan header).
|
|
225
|
+
|
|
226
|
+
---
|
|
227
|
+
|
|
228
|
+
## Principle 10: Serialize State
|
|
229
|
+
|
|
230
|
+
**Rule:** A checkpoint should let someone else resume without guesswork.
|
|
231
|
+
If you were hit by a bus, could the next person pick up from your notes?
|
|
232
|
+
|
|
233
|
+
**Violation:** An agent session ends mid-feature with code in a broken
|
|
234
|
+
state. The commit message is "WIP." The decisions made during the session
|
|
235
|
+
are in the chat history that the next session can't access. The next agent
|
|
236
|
+
starts over from scratch.
|
|
237
|
+
|
|
238
|
+
**Compliance:** Before ending the session, the agent writes a handoff note:
|
|
239
|
+
"Completed: user model and migration. In progress: registration endpoint
|
|
240
|
+
(handler skeleton exists, validation not started). Blocked on: email
|
|
241
|
+
service config (need SMTP credentials in env). Assumptions: using bcrypt
|
|
242
|
+
for passwords per decision 2025-01-15." The next session reads this and
|
|
243
|
+
picks up exactly where the work stopped.
|
|
244
|
+
|
|
245
|
+
**Related:** `closing-the-loop.md` (enforces serialization at turn end),
|
|
246
|
+
`decisions.md` (persistent state across sessions).
|
|
247
|
+
|
|
248
|
+
---
|
|
249
|
+
|
|
250
|
+
## Principle 11: Delegate with Rules, Not Vibes
|
|
251
|
+
|
|
252
|
+
**Rule:** Before starting work, ask: can I define correctness right now?
|
|
253
|
+
Yes → proceed. Missing facts → research. Unclear requirement → escalate.
|
|
254
|
+
Don't start building on "I think the user probably wants..."
|
|
255
|
+
|
|
256
|
+
**Violation:** The agent is asked to "improve the search." It spends 4
|
|
257
|
+
hours implementing Elasticsearch integration. The user meant "add a filter
|
|
258
|
+
dropdown to the existing search results page." The work is discarded.
|
|
259
|
+
|
|
260
|
+
**Compliance:** The agent asks: "Improve search could mean several things.
|
|
261
|
+
Which of these: (A) add filters to existing search, (B) improve result
|
|
262
|
+
relevance ranking, (C) switch to a dedicated search engine like
|
|
263
|
+
Elasticsearch? I recommend starting with A — it's the lowest-risk
|
|
264
|
+
improvement. What do you think?"
|
|
265
|
+
|
|
266
|
+
**Related:** `brainstorming.md` (clarifying questions step),
|
|
267
|
+
`workflow-classifier.md` (scope determines classification).
|
|
268
|
+
|
|
269
|
+
---
|
|
270
|
+
|
|
271
|
+
## Principle 12: Close the Loop
|
|
272
|
+
|
|
273
|
+
**Rule:** Record failures and wins; feed both back into future prompts.
|
|
274
|
+
Knowledge that isn't written down doesn't survive the session.
|
|
275
|
+
|
|
276
|
+
**Violation:** The agent discovers that the ORM silently truncates strings
|
|
277
|
+
longer than 255 characters in a specific column. It fixes the schema but
|
|
278
|
+
doesn't record the discovery. Three months later, a different column has
|
|
279
|
+
the same issue and takes another full debugging session to diagnose.
|
|
280
|
+
|
|
281
|
+
**Compliance:** The agent appends to `anti-patterns.md`: "ORM silently
|
|
282
|
+
truncates strings at column-defined length with no error. Root cause:
|
|
283
|
+
MySQL STRICT_TRANS_TABLES was off. Rule: always enable strict mode; add
|
|
284
|
+
length validation in the application layer, don't rely on the database to
|
|
285
|
+
reject." Future sessions read this entry first.
|
|
286
|
+
|
|
287
|
+
**Related:** `closing-the-loop.md` (the skill that enforces this
|
|
288
|
+
principle), `anti-patterns.md` and `decisions.md` (the two logs).
|
|
289
|
+
|
|
290
|
+
---
|
|
291
|
+
|
|
292
|
+
## Why this matters
|
|
293
|
+
|
|
294
|
+
Output quality depends on input context quality more than on "prompting
|
|
295
|
+
skill." Most failures trace back to one of:
|
|
296
|
+
|
|
297
|
+
- Vague or missing context (principle 1) — fix the input, not the model.
|
|
298
|
+
- A single-shot answer treated as final (principle 2) — iterate instead.
|
|
299
|
+
- A long session that silently lost an earlier decision (principle 3) —
|
|
300
|
+
checkpoint to `.agent-room/decisions.md`.
|
|
301
|
+
- A claim made without forcing the model (or yourself) to explain it
|
|
302
|
+
(principle 4) — ask "what could fail here?" before shipping.
|
|
303
|
+
- The same mistake repeated because nobody wrote it down (principle 5/12) —
|
|
304
|
+
log it in `.agent-room/anti-patterns.md`.
|
|
305
|
+
|
|
306
|
+
> Fill the context with the right information at the right time.
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: brainstorming
|
|
3
|
+
description: "Use before any creative work - creating features, building components, adding functionality, or modifying behavior. Explores intent, requirements and design before implementation."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Brainstorming Ideas Into Designs
|
|
7
|
+
|
|
8
|
+
## Overview
|
|
9
|
+
|
|
10
|
+
Turn an idea into a fully formed design through collaborative dialogue
|
|
11
|
+
before writing any code.
|
|
12
|
+
|
|
13
|
+
<HARD-GATE>
|
|
14
|
+
Do NOT write code, scaffold a project, or take any implementation action
|
|
15
|
+
until a design has been presented and approved. This applies to every
|
|
16
|
+
project regardless of perceived simplicity.
|
|
17
|
+
</HARD-GATE>
|
|
18
|
+
|
|
19
|
+
## Anti-pattern: "this is too simple to need a design"
|
|
20
|
+
|
|
21
|
+
A todo list, a single-function utility, a config change — all of them go
|
|
22
|
+
through this process. "Simple" work is where unexamined assumptions cause
|
|
23
|
+
the most wasted effort. The design can be a few sentences for truly simple
|
|
24
|
+
work, but it must be presented and approved.
|
|
25
|
+
|
|
26
|
+
## Process
|
|
27
|
+
|
|
28
|
+
1. **Explore project context** — read `.agent-room/decisions.md`,
|
|
29
|
+
`.agent-room/anti-patterns.md`, relevant docs, recent commits.
|
|
30
|
+
2. **Ask clarifying questions, one at a time** — multiple-choice preferred,
|
|
31
|
+
open-ended is fine. Focus on purpose, constraints, success criteria.
|
|
32
|
+
3. **Propose 2-3 approaches** with trade-offs, leading with a recommendation
|
|
33
|
+
and why.
|
|
34
|
+
4. **Present the design in sections**, scaled to complexity (a few sentences
|
|
35
|
+
if straightforward, up to 200-300 words if nuanced). Cover architecture,
|
|
36
|
+
components, data flow, error handling, testing. Ask after each section
|
|
37
|
+
whether it looks right before moving on.
|
|
38
|
+
5. **Write the approved design** to `docs/plans/YYYY-MM-DD-<topic>-design.md`
|
|
39
|
+
and commit it.
|
|
40
|
+
6. **Hand off to implementation** — see "After the design" below.
|
|
41
|
+
|
|
42
|
+
```
|
|
43
|
+
Explore context -> Ask questions (1 at a time) -> Propose 2-3 approaches
|
|
44
|
+
-> Present design (section by section, approve each) -> Write design doc
|
|
45
|
+
-> Implementation (see below)
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## After the design
|
|
49
|
+
|
|
50
|
+
- If a `writing-plans`-style skill/convention is available for this
|
|
51
|
+
project, use it to turn the design into a bite-sized task plan before
|
|
52
|
+
touching code.
|
|
53
|
+
- Otherwise, proceed straight into TDD (`.agent-room/skills/test-driven-development.md`),
|
|
54
|
+
using the design doc as the spec, one task at a time, with frequent commits.
|
|
55
|
+
- Do not skip straight to a broad implementation pass — even with an
|
|
56
|
+
approved design, work task-by-task.
|
|
57
|
+
|
|
58
|
+
## Key principles
|
|
59
|
+
|
|
60
|
+
- One question at a time — don't overwhelm with multiple questions.
|
|
61
|
+
- Multiple choice preferred over open-ended when reasonable.
|
|
62
|
+
- YAGNI ruthlessly — remove unnecessary features from the design.
|
|
63
|
+
- Always propose alternatives before settling on one.
|
|
64
|
+
- Get incremental approval; be ready to revise when something doesn't add up.
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: closing-the-loop
|
|
3
|
+
description: "Use before ending any turn that fixed a bug, changed behavior, or made a design call - check whether it belongs in anti-patterns.md or decisions.md."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Closing the Loop
|
|
7
|
+
|
|
8
|
+
## Overview
|
|
9
|
+
|
|
10
|
+
Knowledge that isn't written down doesn't survive the session. A bug's root
|
|
11
|
+
cause, a rejected approach, a "this looked right but wasn't" — if it's not in
|
|
12
|
+
`.agent-room/anti-patterns.md` or `.agent-room/decisions.md`, the next
|
|
13
|
+
session (or the next you) re-derives it from scratch, or repeats it.
|
|
14
|
+
|
|
15
|
+
## The iron law
|
|
16
|
+
|
|
17
|
+
```
|
|
18
|
+
NO TURN ENDS WITHOUT A LOG CHECK
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
This doesn't mean every turn needs a log entry — most don't. It means every
|
|
22
|
+
turn that changed behavior or made a non-obvious call must be **checked**
|
|
23
|
+
against the two questions below before you consider the work done.
|
|
24
|
+
|
|
25
|
+
## The check
|
|
26
|
+
|
|
27
|
+
Before finishing any turn that touched code outside `.agent-room/` or
|
|
28
|
+
`docs/plans/`, ask:
|
|
29
|
+
|
|
30
|
+
1. **Did I find a root cause for a bug, or learn that an approach doesn't
|
|
31
|
+
work?** → append an entry to `.agent-room/anti-patterns.md`.
|
|
32
|
+
2. **Did I make an architecture/design call that wasn't forced — i.e.
|
|
33
|
+
someone could reasonably ask "why this way?"** → append an entry to
|
|
34
|
+
`.agent-room/decisions.md`.
|
|
35
|
+
|
|
36
|
+
If neither applies — a routine, obvious change — say so explicitly rather
|
|
37
|
+
than silently skipping the check. In a project with the Claude Code hook
|
|
38
|
+
installed (see `CLAUDE.md`), state it as a one-line waiver in
|
|
39
|
+
`.agent-room/decisions.md`:
|
|
40
|
+
|
|
41
|
+
```
|
|
42
|
+
<!-- no-log: routine change, no decision or anti-pattern worth recording -->
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
This keeps the check enforceable: "I thought about it and there was nothing
|
|
46
|
+
to log" is a valid outcome, but it has to be visible, not assumed.
|
|
47
|
+
|
|
48
|
+
## What belongs in each log
|
|
49
|
+
|
|
50
|
+
**`anti-patterns.md`** — things that went wrong: a bug's actual root cause
|
|
51
|
+
(not the symptom), an approach that seemed reasonable but wasn't, a fix that
|
|
52
|
+
got reverted. Short format: what happened, root cause, the rule that would
|
|
53
|
+
have prevented it.
|
|
54
|
+
|
|
55
|
+
**`decisions.md`** — choices that could have gone another way: picking one
|
|
56
|
+
library/pattern over another, a scope cut, a trade-off accepted under a
|
|
57
|
+
constraint. Short format: the decision, why, what was rejected.
|
|
58
|
+
|
|
59
|
+
**Skip both for:** typo fixes, formatting, dependency bumps with no
|
|
60
|
+
surprises, anything where the "why" is fully obvious from the diff itself.
|
|
61
|
+
|
|
62
|
+
## Why this is its own skill, not just advice
|
|
63
|
+
|
|
64
|
+
`verification-before-completion.md` makes sure you don't claim done without
|
|
65
|
+
evidence. This skill makes sure "done" also means "and I didn't let
|
|
66
|
+
something worth remembering evaporate." They're both completion gates;
|
|
67
|
+
they check different things.
|