Skip to content

Commit 6598957

Browse files
authored
Merge pull request #67 from MaxLinCode/claude/update-docs
Update docs and claude.md
2 parents 1c3de94 + 0e9a543 commit 6598957

5 files changed

Lines changed: 51 additions & 17 deletions

File tree

.claude/settings.json

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"hooks": {
3+
"WorktreeCreate": [
4+
{
5+
"matcher": "*",
6+
"hooks": [
7+
{
8+
"type": "command",
9+
"command": "jq -r '.worktree_path // .path // \"\"' | { read -r p; [ -n \"$p\" ] && (cd \"$p\" && pnpm install) || true; }",
10+
"statusMessage": "Installing dependencies in worktree"
11+
}
12+
]
13+
}
14+
]
15+
}
16+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Subproject commit c0484444d23129beaab1780cca4aaf97bda4601f

.worktrees/atlas-update-docs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Subproject commit 1c3de94ad96ca681f1131afbb03eb7032e174b74

CLAUDE.md

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,13 +111,37 @@ Build Atlas as a production-quality, Telegram-first planning assistant. The code
111111
## Git Workflow Rules
112112

113113
- **Every workflow — no exceptions — must use a git worktree and a dedicated branch.**
114-
- Create a worktree before touching any files: `git worktree add ../atlas-<short-description> -b codex/<short-description>`
114+
- Create a worktree before touching any files: `git worktree add .worktrees/atlas-<short-description> -b claude/<short-description>`
115115
- All edits, experiments, and commits happen inside that worktree, never in the main checkout.
116116
- This prevents dirty-worktree collisions between concurrent tasks (e.g. formatting runs vs. feature work).
117117
- Follow `docs/workflows/feature-delivery.md` for product features, fixes, and behavior changes.
118118
- Do not commit or push implementation work directly to `main`.
119119
- If work is accidentally committed on `main`, move it to a feature branch before pushing.
120120

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`.
125+
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.
131+
132+
- **Direct commits or merges to `main` are not allowed by default.**
133+
- All changes must land via a dedicated branch.
134+
- Prefer PR-based merges, even for small changes.
135+
- Fast-forward merges from a clean branch are acceptable after work is complete.
136+
137+
- Follow `docs/workflows/feature-delivery.md` for product features, fixes, and behavior changes.
138+
139+
- If work is accidentally committed on `main`, move it to a feature branch before pushing.
140+
141+
- Remove temporary worktrees after merge:
142+
- git worktree remove .worktrees/atlas-<short-description>
143+
- git branch -d claude/<short-description> (if fully merged)
144+
121145
## Execution Rules
122146

123147
- Before finishing, run the narrowest relevant checks for the touched code.

docs/current-work.md

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -270,34 +270,26 @@ PR #53 (`codex/turn-routing-refactor`) implements the 3-layer turn routing pipel
270270

271271
### Medium — fix before merge
272272

273-
1. **`interpretTurn.ts` is now a divergent partial pipeline.** `turn-router.ts` runs the full 3-layer pipeline and builds `TurnInterpretation` via `buildInterpretation()`. `interpretTurn.ts` does its own classification + ambiguity derivation without slot extraction or commit policy. The two files derive ambiguity differently — `turn-router.ts` considers `commitResult.missingSlots` and `needsClarification`, `interpretTurn.ts` does not. Either consolidate into one entry point or remove `interpretTurn` if nothing calls it directly anymore.
274-
275-
2. **`SLOT_COMMITTING_TURN_TYPES` is duplicated** in `packages/core/src/commit-policy.ts:20` and `apps/web/src/lib/server/turn-router.ts:27`. Export from one location (core) and import in the other. If they diverge, the pipeline gate breaks silently.
276-
277-
3. **No hour/minute range validation in `slot-normalizer.ts`.** The zod schema validates `z.number().int()` but not 0–23 for hour or 0–59 for minute. If the LLM returns `{ hour: 25, minute: 70 }`, it becomes `"25:70"` — an invalid time committed as a resolved slot. Add range constraints to the schema or a guard in the normalizer.
278-
279-
4. **Business logic growing in `decide-turn-policy.ts`** (`deriveConsentRequirement`, `deriveProposalCompatibility`, `deriveParameterFingerprint`, `deriveActionKind`) — these are product-level decision functions that should live in `packages/core` per the architecture rules. The file grew from ~70 to ~375 lines.
280-
281-
5. **Slot extraction is gated on `pending_write_contract` being truthy** (`turn-router.ts:53-55`), not just on turn type. The first planning request in a conversation (before any contract is set) skips extraction entirely. `DEFAULT_CONTRACT` is defined but only used for `applyCommitPolicy`. This may cause the initial "schedule gym tomorrow at 6pm" to get no extracted slots. Decide whether this is intentional or whether extraction should run against `DEFAULT_CONTRACT` when no contract exists.
273+
1. **Slot extraction is gated on `pending_write_contract` being truthy** (`turn-router.ts:53-55`), not just on turn type. The first planning request in a conversation (before any contract is set) skips extraction entirely. `DEFAULT_CONTRACT` is defined but only used for `applyCommitPolicy`. This may cause the initial "schedule gym tomorrow at 6pm" to get no extracted slots. Decide whether this is intentional or whether extraction should run against `DEFAULT_CONTRACT` when no contract exists.
282274

283275
### Low — address in follow-up
284276

285-
6. **`resolved_slots` is `.optional()` in the discourse state schema** but `createEmptyDiscourseState` always initializes it to `{}`. Defensive `?? {}` fallbacks are scattered throughout. Make it required in the schema.
277+
2. **`resolved_slots` is `.optional()` in the discourse state schema** but `createEmptyDiscourseState` always initializes it to `{}`. Defensive `?? {}` fallbacks are scattered throughout. Make it required in the schema.
286278

287-
7. **Nullable confidence types in schema vs non-nullable in policy.** `slotConfidenceSchema` uses `.nullable().optional()` per slot but `CommitPolicyInput` types confidence as `Partial<Record<SlotKey, number>>`. The `compactConfidence` bridge function handles the mismatch, but the schema should be non-nullable to match.
279+
3. **Nullable confidence types in schema vs non-nullable in policy.** `slotConfidenceSchema` uses `.nullable().optional()` per slot but `CommitPolicyInput` types confidence as `Partial<Record<SlotKey, number>>`. The `compactConfidence` bridge function handles the mismatch, but the schema should be non-nullable to match.
288280

289-
8. **`TurnTrace` and `_provenance` from the spec are not implemented.** The observability and provenance section calls for fire-and-forget turn traces and a provenance map on `ResolvedSlots`. These may be intentionally deferred but should be tracked.
281+
4. **`TurnTrace` and `_provenance` from the spec are not implemented.** The observability and provenance section calls for fire-and-forget turn traces and a provenance map on `ResolvedSlots`. These may be intentionally deferred but should be tracked.
290282

291-
9. **No integration test for multi-turn slot accumulation.** Commit policy tests verify slot preservation in isolation, but no test exercises the full path where `committedSlots` are persisted through `conversation-state.ts` and used as `priorResolvedSlots` in a subsequent turn.
283+
5. **No integration test for multi-turn slot accumulation.** Commit policy tests verify slot preservation in isolation, but no test exercises the full path where `committedSlots` are persisted through `conversation-state.ts` and used as `priorResolvedSlots` in a subsequent turn.
292284

293-
10. **`deriveParameterFingerprint` regex** (`\b\d{1,2}(?::\d{2})?\s?(?:am|pm)?\b`) matches bare numbers like "3" in any context, which may trigger unnecessary re-consent in proposal compatibility checks.
285+
6. **`deriveParameterFingerprint` regex** (`\b\d{1,2}(?::\d{2})?\s?(?:am|pm)?\b`) matches bare numbers like "3" in any context, which may trigger unnecessary re-consent in proposal compatibility checks.
294286

295287
### Recommended merge sequence
296288

297-
1. Fix items 1–5 on the existing branch
289+
1. Address item 1 on the existing branch if needed
298290
2. Run `pnpm typecheck && pnpm --filter @atlas/core test && pnpm --filter @atlas/web test`
299291
3. Merge PR #53
300-
4. Open follow-up issue for items 6–10
292+
4. Open follow-up issue for items 2–6
301293

302294
### Follow-up — clarification state cleanup (separate PR)
303295

0 commit comments

Comments
 (0)