Skip to content

Commit ba4d652

Browse files
MaxLinCodeclaude
andcommitted
Update AGENTS.md, CLAUDE.md, skills, and .dippy with workflow improvements
- Expand AGENTS.md with full Search & Discovery Protocol and Codebase Map - Tighten CLAUDE.md Git Workflow Rules (worktree-first, cleaner structure) - Update atlas-feature-delivery and atlas-reviewer skills to reference CLAUDE.md - Add docs/architecture/planning-request-flow.md - Expand .dippy git allowlist (add, commit, show, restore --staged) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 89dcf15 commit ba4d652

6 files changed

Lines changed: 769 additions & 45 deletions

File tree

.dippy

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
# .dippy
22

33
# Let normal read / inspect commands flow
4-
allow git status
5-
allow git diff
6-
allow git log
74
allow ls
85
allow pwd
96
allow cat
@@ -13,12 +10,21 @@ allow rg
1310
allow find
1411
allow jq
1512

13+
# allow git workflow
14+
allow git status
15+
allow git diff
16+
allow git log
17+
allow git add
18+
allow git add -p
19+
allow git commit
20+
allow git show
21+
allow git restore --staged
22+
1623
# Let normal monorepo validation commands flow
1724
allow pnpm --filter * typecheck
1825
allow pnpm --filter * test
1926
allow pnpm --filter * lint
2027
allow pnpm biome *
21-
allow pnpm exec biome *
2228
allow pnpm tsc *
2329
allow pnpm vitest *
2430
allow pnpm jest *

AGENTS.md

Lines changed: 103 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,83 @@
1-
# AGENTS.md
1+
# Agent Instructions
2+
3+
These instructions define the required search and discovery workflow.
4+
These rules take precedence over other exploration strategies.
5+
Always follow this protocol before reading multiple files or performing refactors.
6+
If you are about to search broadly or read many files, stop and apply this protocol first.
7+
8+
## Global Priorities
9+
10+
1. Minimize unnecessary file reads and token usage
11+
2. Follow the Search & Discovery Protocol before broad exploration
12+
3. Respect package ownership boundaries
13+
4. Prefer modifying existing modules over creating new ones
14+
15+
## Search & Discovery Protocol
16+
17+
1. File Discovery (fd)
18+
- Always start with fd
19+
- Prefer fd over `rg --files` for file enumeration
20+
- Never use find or ls -R
21+
- If results >200 files, refine
22+
- Example: fd -e ts auth
23+
24+
25+
2. Text Search (rg)
26+
- Use rg for literals and narrowing
27+
- Prefer -l / --files-with-matches first to identify target files
28+
- Use -S (smart-case) to avoid casing misses
29+
- Scope by extension when possible
30+
- If results >50 files, refine
31+
- Example: rg -S -t ts --files-with-matches "useAuth"
32+
33+
3. Structural Search (sg)
34+
- Use sg for syntax-aware queries
35+
- Run after fd/rg narrowing
36+
- Remember that many TS functions are arrow functions; use broader patterns when needed
37+
- Examples:
38+
- sg -p 'function $NAME($$$) { $$$ }'
39+
- sg -p 'const $NAME = ($$$) => { $$$ }'
40+
41+
4. Read Minimally
42+
- Prefer rg -n -C 3 over full file reads
43+
- Read order: config → entry → tests → impl
44+
45+
5. Refactor Safety
46+
- Use fd to scope before large changes
47+
- Verify file count
48+
- Sample a few files first
49+
50+
Power Pattern (bounded scan):
51+
fd -e ts . src/logic/ -x sg -p 'function $F($$$) { $$$ }'
52+
53+
Note:
54+
- Use only when the directory is already narrow (<50 files)
55+
- This is a shortcut for function inventory, not for whole-repo scans
56+
- If unsure, run `fd` first to confirm file count
57+
58+
## Codebase Map
59+
60+
High-level module ownership:
61+
62+
- `apps/web` — delivery surfaces (API routes, cron entrypoints, admin pages)
63+
- `packages/core` — product logic, planning behavior, schemas, scheduling rules
64+
- `packages/db` — persistence, repositories, database access
65+
- `packages/integrations` — external APIs and transport adapters
66+
- `docs/` — architecture, workflows, and decision records
67+
68+
Navigation hints:
69+
70+
- Start in `packages/core` for business logic questions
71+
- Start in `apps/web` for request/route entrypoints
72+
- Start in `packages/db` for data access or persistence issues
73+
- Start in `packages/integrations` for external API behavior
74+
- Check `docs/architecture.md` for system-level flows
275

376
## Mission
477

578
Build Atlas as a production-quality, Telegram-first planning assistant. The codebase should stay understandable to a new contributor and safe for repeated agent-driven edits.
679

7-
## Architecture rules
80+
## Architecture Rules
881

982
- `apps/web` owns delivery surfaces only: API routes, cron entrypoints, and internal admin pages.
1083
- Business logic belongs in `packages/*`, not in route handlers or page components.
@@ -13,37 +86,54 @@ Build Atlas as a production-quality, Telegram-first planning assistant. The code
1386
- `packages/db` implements persistence and repositories; do not spread SQL or ORM calls throughout the app.
1487
- `packages/integrations` owns external API clients and transport adapters, not product logic.
1588

16-
## Anti-slop guardrails
89+
## Anti-Slop Guardrails
1790

1891
- Prefer extending an existing module before creating a new abstraction.
1992
- Do not add a dependency without a short reason in the change summary.
2093
- No catch-all `utils` files unless the helpers are truly cross-cutting and cohesive.
2194
- Keep files focused. If a file starts spanning multiple responsibilities, split by behavior.
2295
- Keep comments rare and purposeful. Explain why, not what.
2396

24-
## Testing rules
97+
## Testing Rules
2598

2699
- Every core business rule or planning/scheduling heuristic should have a unit test.
27100
- Every webhook, reminder, or replanning bug fix requires an integration test.
28101
- Structured OpenAI outputs must be validated at the boundary and covered by contract tests.
29102

30-
## Documentation rules
103+
## Documentation Rules
31104

32105
- Update `README.md` when setup or core commands change.
33106
- Update `docs/architecture.md` when dependency direction or major flow changes.
34107
- When touching schemas, migrations, persisted records, ingestion record creation, or core data types, verify the change matches `docs/architecture/data-model-boundaries.md` and update that doc if the ownership model changes.
35108
- Add an ADR in `docs/decisions/` for meaningful infrastructure or architecture decisions.
36109
- Update `docs/current-work.md` when the active implementation focus changes.
37110

38-
## Git workflow rules
111+
### Git Workflow Rules
112+
113+
- Every workflow — no exceptions — must use a git worktree and a dedicated branch.
114+
- Create a worktree before touching any files:
115+
`git worktree add .worktrees/atlas-<short-description> -b claude/<short-description>`
116+
- All edits, experiments, and commits must happen inside that worktree.
117+
- Never modify files in the main checkout.
39118

40-
- Follow `docs/workflows/feature-delivery.md` for product features, fixes, and behavior changes.
41-
- For any non-trivial code change, work on a feature branch named `codex/<short-description>`.
42119
- Do not commit or push implementation work directly to `main`.
43-
- Before pushing, confirm the current branch is not `main`.
44-
- If work is accidentally committed on `main`, move it to a feature branch before pushing.
120+
- If work is accidentally committed on `main`, move it to a feature branch before pushing.
121+
122+
- All changes must land via a dedicated branch.
123+
- Prefer PR-based merges, even for small changes.
124+
- Fast-forward merges from a clean branch are acceptable after work is complete.
125+
126+
- Commit per logical change, not per file.
127+
- Stage only files related to the current change.
128+
- Write descriptive commit messages explaining the intent.
129+
130+
- Follow `docs/workflows/feature-delivery.md` for product features, fixes, and behavior changes.
131+
132+
- Clean up after completion:
133+
- `git worktree remove .worktrees/atlas-<short-description>`
134+
- `git branch -d claude/<short-description>` (if fully merged)
45135

46-
## Execution rules
136+
## Execution Rules
47137

48138
- Before finishing, run the narrowest relevant checks for the touched code.
49139
- For changes isolated to one package, prefer `pnpm --filter <package> typecheck` and `pnpm --filter <package> test`.
@@ -52,11 +142,11 @@ Build Atlas as a production-quality, Telegram-first planning assistant. The code
52142
- If dependencies, workspace config, Next.js config, or build tooling change, run `pnpm build`.
53143
- In the final response, summarize which checks ran and call out anything not verified.
54144

55-
## Done definition
145+
## Done Definition
56146

57147
A task is complete when:
58148

59149
- the requested behavior exists,
60150
- affected checks pass,
61151
- docs are updated when setup, commands, or architecture changed,
62-
- and any skipped verification is clearly called out.
152+
- and any skipped verification is clearly called out.

CLAUDE.md

Lines changed: 16 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -108,39 +108,30 @@ Build Atlas as a production-quality, Telegram-first planning assistant. The code
108108
- Add an ADR in `docs/decisions/` for meaningful infrastructure or architecture decisions.
109109
- Update `docs/current-work.md` when the active implementation focus changes.
110110

111-
## Git Workflow Rules
111+
### Git Workflow Rules
112112

113-
- **Every workflow — no exceptions — must use a git worktree and a dedicated branch.**
114-
- Create a worktree before touching any files: `git worktree add .worktrees/atlas-<short-description> -b claude/<short-description>`
115-
- All edits, experiments, and commits happen inside that worktree, never in the main checkout.
116-
- This prevents dirty-worktree collisions between concurrent tasks (e.g. formatting runs vs. feature work).
117-
- Follow `docs/workflows/feature-delivery.md` for product features, fixes, and behavior changes.
118-
- Do not commit or push implementation work directly to `main`.
119-
- If work is accidentally committed on `main`, move it to a feature branch before pushing.
120-
121-
- **Every workflow - no exceptions - must use a dedicated branch.**
122-
- Create a branch before making changes:
123-
git switch -c claude/<short-description>
124-
- Do not perform implementation work directly on `main`.
113+
- Every workflow — no exceptions — must use a git worktree and a dedicated branch.
114+
- Create a worktree before touching any files:
115+
`git worktree add .worktrees/atlas-<short-description> -b claude/<short-description>`
116+
- All edits, experiments, and commits must happen inside that worktree.
117+
- Never modify files in the main checkout.
125118

126-
- **Use a git worktree when work may run in parallel or overlap.**
127-
- Examples: concurrent tasks, long-running edits, formatting passes, refactors, or agent-driven work.
128-
- Create the worktree before touching files:
129-
git worktree add .worktrees/atlas-<short-description> -b claude/<short-description>
130-
- All edits and commits for that workflow must happen inside that worktree, never in the main checkout.
119+
- Do not commit or push implementation work directly to `main`.
120+
- If work is accidentally committed on `main`, move it to a feature branch before pushing.
131121

132-
- **Direct commits or merges to `main` are not allowed by default.**
133-
- All changes must land via a dedicated branch.
122+
- All changes must land via a dedicated branch.
134123
- Prefer PR-based merges, even for small changes.
135124
- Fast-forward merges from a clean branch are acceptable after work is complete.
136125

137-
- Follow `docs/workflows/feature-delivery.md` for product features, fixes, and behavior changes.
126+
- Commit per logical change, not per file.
127+
- Stage only files related to the current change.
128+
- Write descriptive commit messages explaining the intent.
138129

139-
- If work is accidentally committed on `main`, move it to a feature branch before pushing.
130+
- Follow `docs/workflows/feature-delivery.md` for product features, fixes, and behavior changes.
140131

141-
- Remove temporary worktrees after merge:
142-
- git worktree remove .worktrees/atlas-<short-description>
143-
- git branch -d claude/<short-description> (if fully merged)
132+
- Clean up after completion:
133+
- `git worktree remove .worktrees/atlas-<short-description>`
134+
- `git branch -d claude/<short-description>` (if fully merged)
144135

145136
## Execution Rules
146137

0 commit comments

Comments
 (0)