Skip to content

Commit 3893102

Browse files
cojiclaude
andauthored
feat: takt ワークフロー導入 (#272)
* feat: takt ワークフロー導入 durably の .takt/ 構成をベースに upflow 向けにカスタマイズ: - spec-implement-accept ピース(フルフロー: 仕様 → レビュー → 実装 → 受入 → 監督) - implement-step ピース(単一ステップ: 実装 → 並列レビュー → 修正) - DB マイグレーション手順を knowledge/policy/instruction に組み込み - マルチテナントセキュリティチェックを spec-review に追加 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: CodeRabbit レビュー指摘を反映 - provider_profiles の default_permission_mode を full → edit に制限 - git diff --name-only に HEAD を明示(acceptance, supervise) - spec-review-report にマルチテナントセキュリティチェック項目を追加 - supervise-report に PLAN.md unmodified チェックを追加 - DROP TABLE の IF EXISTS ルールで Atlas 生成分と手動分を明確に区別 - loop_monitor の分岐を分離(blocking 未解決時は ABORT) - 英語表現の修正(supervise report → supervision report 等) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent f741e2a commit 3893102

17 files changed

Lines changed: 886 additions & 0 deletions

.takt/.gitignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Runtime data (not version-controlled)
2+
runs/
3+
tasks/
4+
clone-meta/
5+
worktree-sessions/
6+
session-state.json
7+
persona_sessions.json

.takt/config.yaml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
provider: claude
2+
model: claude-opus-4-6
3+
4+
auto_pr: false
5+
draft_pr: false
6+
7+
persona_providers:
8+
coder:
9+
provider: cursor
10+
model: composer-2-fast
11+
architecture-reviewer:
12+
provider: codex
13+
model: gpt-5.4
14+
acceptor:
15+
provider: codex
16+
model: gpt-5.4
17+
supervisor:
18+
provider: codex
19+
model: gpt-5.4
20+
21+
provider_profiles:
22+
cursor:
23+
default_permission_mode: edit
24+
codex:
25+
default_permission_mode: edit
26+
claude:
27+
default_permission_mode: edit
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# Acceptance Testing Procedure
2+
3+
Verify that the implementation meets the completion criteria of the task spec (order.md).
4+
5+
## Steps
6+
7+
1. List all completion criteria from order.md
8+
9+
2. For each completion criterion:
10+
- Read the relevant code and verify the implementation
11+
- Judge whether the criterion is met as Yes/No
12+
- If No, describe the specific deficiency
13+
14+
3. Run validation:
15+
16+
```bash
17+
pnpm validate
18+
```
19+
20+
Confirm that all checks (format, lint, typecheck, build, test) pass
21+
22+
4. If the task involves DB schema changes, also run:
23+
24+
```bash
25+
pnpm db:setup
26+
```
27+
28+
Confirm that clean-slate migration + seed succeeds
29+
30+
5. Scope check:
31+
- Get the list of changed files with `git diff --name-only HEAD`
32+
- Cross-reference with the files to change listed in order.md
33+
- Check for any out-of-scope changes (refer to prohibited actions in the policy)
34+
35+
6. Judgment:
36+
- All completion criteria Yes and validation passes -> approved
37+
- Otherwise -> needs_fix (include specific fix instructions)
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
# Spec Draft Procedure
2+
3+
Generate order.md based on the task description (issue body or user input).
4+
5+
## Steps
6+
7+
1. Read the task description and understand the purpose and scope of the implementation
8+
9+
2. Investigate existing code:
10+
- Identify files likely to be changed
11+
- Review existing structure, patterns, and dependencies
12+
- Check for test files and their organization
13+
14+
3. Generate order.md (with the following structure):
15+
16+
```markdown
17+
# Task Name
18+
19+
## Overview
20+
21+
What to do (1-3 sentences)
22+
23+
## Background
24+
25+
Why this is needed (may quote from the issue)
26+
27+
## Files to Change
28+
29+
- path/to/file.ts — Summary of changes
30+
31+
## Implementation Details
32+
33+
- List specific changes as bullet points
34+
- Do not include code examples (describe what to do, not how)
35+
36+
## Database Changes (if applicable)
37+
38+
- Schema file to modify: `db/shared.sql` or `db/tenant.sql`
39+
- New/modified tables and columns
40+
- Migration safety considerations (existing data, destructive operations)
41+
42+
## Completion Criteria
43+
44+
- [ ] List verifiable conditions
45+
- [ ] pnpm validate passes
46+
- [ ] pnpm db:setup passes (if schema changes)
47+
48+
## Out of Scope
49+
50+
- Explicitly state what will not be done
51+
```
52+
53+
4. Run the quality checklist before finalizing
54+
55+
## Quality Checklist
56+
57+
Before completing order.md, verify each item:
58+
59+
- [ ] For refactoring tasks: existing behaviors that must be preserved are listed as explicit completion criteria (not just "keep behavior unchanged")
60+
- [ ] Negative test cases are required where applicable (e.g., "X does NOT happen when Y")
61+
- [ ] Each completion criterion is independently verifiable (can be checked Yes/No without ambiguity)
62+
- [ ] Files to change are confirmed by reading the actual code (not guessed from names)
63+
- [ ] Out of scope items do not contradict the implementation details or files to change
64+
- [ ] Implicit dependencies of changed files are accounted for (e.g., if a function signature changes, callers are in scope)
65+
- [ ] DB schema changes: migration safety is addressed (existing data preservation, IF EXISTS on manual DROP TABLE)
66+
- [ ] DB schema changes: `pnpm db:setup` is included in completion criteria
67+
- [ ] Multi-tenant security: mutations are scoped to org, auth guards are before form parsing
68+
69+
## Rules
70+
71+
- Do not include code examples or snippets (keep it at the requirements level)
72+
- Only list files to change after actually reading the code to confirm
73+
- Completion criteria must be granular enough to be judged as Yes/No
74+
- Do not use vague expressions ("appropriately", "as needed")
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# Spec Review Procedure
2+
3+
Review the task spec (order.md) and the existing code targeted for changes.
4+
5+
## Steps
6+
7+
1. Read order.md and verify the following:
8+
- Whether the implementation details are clear
9+
- Whether the files to change are comprehensive (including implicit dependencies)
10+
- Whether the completion criteria are verifiable
11+
- Whether the out-of-scope section is clear
12+
13+
2. Actually read the files to change and understand the existing code structure
14+
15+
3. If a supervision report exists (`supervise-report.md`), read it and incorporate its findings into the review
16+
17+
4. Review from the following perspectives:
18+
- Are any files to change missing?
19+
- Are the completion criteria sufficient (edge cases, error handling)?
20+
- Is the scope appropriate (not too large/too small)?
21+
- Can existing patterns or utilities be leveraged?
22+
23+
5. Check for common spec omissions:
24+
25+
**Database changes:**
26+
- If the spec modifies `db/shared.sql` or `db/tenant.sql`: does it address migration safety for existing production data?
27+
- Are destructive operations (DROP TABLE, DROP COLUMN) justified and guarded with `IF EXISTS` where appropriate?
28+
- Is `pnpm db:setup` included in completion criteria?
29+
- Are Kysely type-regeneration (`pnpm db:generate`) consequences accounted for?
30+
31+
**Multi-tenant security:**
32+
- Do mutations scope to the correct organization (shared DB: `WHERE organizationId = ?`, tenant DB: correct `getTenantDb`)?
33+
- Is the auth guard called before `parseWithZod(request.formData())`?
34+
- Are child resource ownership checks included where needed?
35+
36+
**Input validation:**
37+
- New public API options used as counts, concurrency limits, or loop bounds: spec must define the exact valid domain
38+
- Async operations in intervals/loops: is there a guard against concurrent in-flight requests?
39+
40+
**Behavioral preservation:**
41+
- Existing behaviors that must be preserved: are they listed as explicit completion criteria with negative test cases?
42+
43+
## Routing Guide
44+
45+
- **spec-revise** (blocking issues): The spec has concrete problems that can be fixed by editing order.md — missing files, unclear criteria, scope gaps, contradictions between sections
46+
- **implement** (no blocking issues): The spec is clear enough to implement. Suggestion-level improvements can be noted but do not block
47+
- **ABORT** (fundamentally broken): The task itself is incoherent — e.g., the requested change contradicts the project's architecture, the task duplicates already-completed work, or the goal cannot be achieved with the described approach and no alternative is apparent
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Final Verification Procedure
2+
3+
Verify the overall consistency of the implementation and determine whether it can be completed.
4+
5+
## Steps
6+
7+
1. List all completion criteria from order.md and check the status of each
8+
9+
2. Run validation:
10+
11+
```bash
12+
pnpm validate
13+
```
14+
15+
3. If the task involves DB schema changes, also run:
16+
17+
```bash
18+
pnpm db:setup
19+
```
20+
21+
4. Check changed files with `git diff --name-only HEAD`:
22+
- Are there any out-of-scope changes?
23+
- Have order.md or PLAN.md been modified?
24+
25+
5. If an acceptance testing report exists, review any remaining issues
26+
27+
6. Judgment:
28+
- All completion criteria met + validation passes -> ready to complete
29+
- Only minor remaining issues -> issue fix instructions and route to fix
30+
- Spec-level issues -> route back to spec-review
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# Implementation Plan Context
2+
3+
## Source of Truth
4+
5+
- The task order (order.md) is the authoritative spec for the current task
6+
- Do NOT modify order.md — if it seems incomplete, implement what's there
7+
- Completion conditions in the task order are the acceptance criteria
8+
- CLAUDE.md contains project conventions — follow them
9+
10+
## Project Validation
11+
12+
```bash
13+
pnpm validate # lint (Biome), format (Prettier), typecheck, build, test (Vitest)
14+
```
15+
16+
When the task involves DB schema changes, also run:
17+
18+
```bash
19+
pnpm db:setup # Reset DB with migrations + seed data (verifies clean-slate migration)
20+
```
21+
22+
## Database Migration Workflow
23+
24+
1. Edit declarative schema: `db/shared.sql` (shared DB) or `db/tenant.sql` (tenant DB)
25+
2. Generate migration: `pnpm db:migrate`
26+
3. Review the generated SQL — Atlas auto-generates it, but you must verify correctness
27+
4. Apply migration: `pnpm db:apply`
28+
5. Regenerate Kysely types: `pnpm db:generate` (outputs to `app/services/type.ts`)
29+
30+
## Key Conventions (from CLAUDE.md)
31+
32+
- **CamelCasePlugin**: `sql` template literals don't transform identifiers — use `sql.ref('tableName.columnName')`
33+
- **DateTime**: Store as ISO 8601 with Z suffix; parse with `dayjs.utc(value)`; display with `.tz(timezone)`
34+
- **Server files**: `.server.ts` suffix for server-only code
35+
- **Form handling**: Conform + Zod with discriminated union schema + `ts-pattern`
36+
- **Multi-tenant security**: Auth guard before parseWithZod; scope mutations to org
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
```markdown
2+
# Acceptance Testing Result
3+
4+
## Result: APPROVE / REJECT
5+
6+
## Summary
7+
8+
{1-2 sentence summary}
9+
10+
## Completion Criteria Check
11+
12+
| # | Criterion | Result | Notes |
13+
| --- | --------- | ------ | ----- |
14+
| 1 | | Yes/No | |
15+
16+
## Validation
17+
18+
Summary of pnpm validate output
19+
20+
## Database Setup (if applicable)
21+
22+
Summary of pnpm db:setup output
23+
24+
## Scope Check
25+
26+
| Aspect | Result |
27+
| ------------------------------ | ------ |
28+
| Changed files are within scope | OK/NG |
29+
| PLAN.md unmodified | OK/NG |
30+
| order.md unmodified | OK/NG |
31+
32+
## Fix Instructions (if REJECT)
33+
34+
-
35+
```
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
```markdown
2+
# Spec Review Result
3+
4+
## Result: APPROVE / REJECT
5+
6+
Judgment criteria:
7+
8+
- APPROVE: No issues, or only minor improvement suggestions (no impediment to implementation)
9+
- REJECT: Contradictions in requirements, critical omissions in files to change, etc. — proceeding to implementation would certainly cause rework
10+
11+
Minor improvement suggestions (naming alternatives, additional test case ideas, etc.) are filed as issues under APPROVE.
12+
Ambiguity that implementers can reasonably resolve on their own is not grounds for REJECT.
13+
14+
## Summary
15+
16+
{1-2 sentence summary}
17+
18+
## Checklist
19+
20+
| Aspect | Result | Notes |
21+
| ------------------------------------ | ------ | ----- |
22+
| Clarity of implementation scope | OK/NG | |
23+
| Completeness of files to change | OK/NG | |
24+
| Verifiability of completion criteria | OK/NG | |
25+
| Appropriateness of scope | OK/NG | |
26+
| Leveraging existing patterns | OK/NG | |
27+
| Multi-tenant security invariants | OK/NG | |
28+
| DB migration safety (if applicable) | OK/NG | |
29+
30+
## Issues (if any)
31+
32+
Assign a severity to each issue:
33+
34+
- **blocking**: Implementation not possible. Grounds for REJECT
35+
- **suggestion**: Improvement proposal. Communicated to implementer while remaining APPROVE
36+
37+
-
38+
```
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
```markdown
2+
# Final Verification Result
3+
4+
## Judgment: COMPLETE / FIX / SPEC_REVIEW
5+
6+
Judgment criteria:
7+
8+
- COMPLETE: All completion criteria met, validation passes, within scope
9+
- FIX: Implementation-level issues remain (resolvable by code changes)
10+
- SPEC_REVIEW: Spec-level issues (order.md needs modification)
11+
12+
## Summary
13+
14+
{1-2 sentence summary}
15+
16+
## Completion Criteria Check
17+
18+
| # | Criterion | Result | Notes |
19+
| --- | --------- | ------ | ----- |
20+
| 1 | | Yes/No | |
21+
22+
## Validation
23+
24+
Summary of pnpm validate output
25+
26+
## Scope Check
27+
28+
| Aspect | Result |
29+
| ------------------------------ | ------ |
30+
| Changed files are within scope | OK/NG |
31+
| PLAN.md unmodified | OK/NG |
32+
| order.md unmodified | OK/NG |
33+
34+
## Remaining Issues (if FIX / SPEC_REVIEW)
35+
36+
For each issue:
37+
38+
- Description of the issue
39+
- Reason for routing to fix / spec-review
40+
- Specific fix instructions
41+
```

0 commit comments

Comments
 (0)