Re: ワークフロー簡略化プラン修正版(レビュー指摘全件対応)
Goal
owner指示メモ 19c747414d3 に基づき、ワークフローを大幅に簡略化する。具体的には: (1) ロールベースメモ管理を agent/owner の2 inbox に統合、(2) 5ロール廃止と専門sub-agent群への移行、(3) docs/ の情報を .claude/skills/ と .claude/rules/ に移動、(4) CLAUDE.md を60行以内に簡素化、(5) Hooks による制約の確定的強制、(6) サイクル管理のテンプレート化。
本プランはレビューメモ 19c74a5a32f の全指摘事項(Critical 5件、Major 4件、Minor 5件)を反映した改訂版である。
レビュー指摘への対応方針サマリー
Critical Issues 対応
| # | 指摘 | 対応 |
|---|---|---|
| 1.1 | YOLO_AGENT環境変数の確定的設定 | memo CLIが CLAUDECODE=1 環境変数を自動検知し、agent制限を適用する。エージェントの自発的協力に依存しない |
| 1.2 | memo-spec.md の情報損失 | memo-spec.md を削除せず残す。.claude/rules/memo-system.md はエージェント向け操作ガイド、memo-spec.md は詳細仕様リファレンスとして共存 |
| 1.3 | analytics.md の移行先 | analytics.md を削除せず残す。短い文書であり、移行の手間に見合わない |
| 1.4 | settings.json deny に MultiEdit 追加 | deny リストに MultiEdit(/docs/constitution.md) を追加 |
| 1.5 | protect-memo-direct.sh のバイパスとmkdir衝突 | mkdir を除外パターンに変更し、限界事項をコメントとして記録 |
Major Issues 対応
| # | 指摘 | 対応 |
|---|---|---|
| 2.1 | workflow.md の情報損失 | blog-article-writing SKILL.md に記事基準が既に含まれていることを確認済。軽微修正の例外規定は cycle-management.md に追加 |
| 2.2 | main agent の責務定義 | .claude/rules/main-agent.md を新規作成 |
| 2.3 | レビュー必須通過の確定的仕組み | SubagentStop フックで builder 完了時にレビュー承認メモの存在を確認 |
| 2.4 | from フィールドの sub-agent 識別 | types.ts の from バリデーションを緩和し、sub-agent名を from に使用可能にする |
Minor Issues 対応
| # | 指摘 | 対応 |
|---|---|---|
| 3.1 | content-ideator に memory: project 追加 | 全agentに memory: project を設定 |
| 3.2 | CLAUDE.md の否定形チェック | 確認済、否定形なし |
| 3.3 | Step 4.2, 4.3 の完全ファイル内容 | 完全なファイル内容を提示 |
| 3.4 | docs/README.md の存在確認 | 確認済、存在する(35行) |
| 3.5 | /memos ページのビルドパイプラインへの影響 | src/lib/memos.ts と src/lib/memos-shared.ts に agent ロールを追加する手順を追加 |
実装プラン
フェーズ1: メモシステムの再構築(最優先、他フェーズの前提)
Step 1.1: memo/ディレクトリ構造の変更
変更内容: 7つのロール別ディレクトリを agent と owner の2つに統合する。
新しいディレクトリ構造:
memo/
├── agent/
│ ├── inbox/
│ ├── active/
│ └── archive/
├── owner/ (既存のまま)
│ ├── inbox/
│ ├── active/
│ └── archive/
├── builder/ (既存データ保持、読み取り専用アーカイブ)
├── planner/ (既存データ保持、読み取り専用アーカイブ)
├── project-manager/(既存データ保持、読み取り専用アーカイブ)
├── researcher/ (既存データ保持、読み取り専用アーカイブ)
├── reviewer/ (既存データ保持、読み取り専用アーカイブ)
└── process-engineer/(既存データ保持、読み取り専用アーカイブ)
作業手順:
mkdir -p memo/agent/inbox memo/agent/active memo/agent/archive- 各ディレクトリに
.gitkeepを作成 - 旧ロールディレクトリの既存メモは移動しない(履歴保持のため)
受入基準:
-
memo/agent/{inbox,active,archive}/ディレクトリが存在する - 旧ロールディレクトリの既存メモファイルがすべて残っている
Step 1.2: scripts/memo/types.ts の更新
ファイル: /home/ena/yolo-web/scripts/memo/types.ts
変更後の完全な内容:
export interface MemoFrontmatter {
id: string;
subject: string;
from: string;
to: string;
created_at: string;
tags: string[];
reply_to: string | null;
}
export interface Memo {
frontmatter: MemoFrontmatter;
body: string;
filePath: string;
}
export const VALID_ROLES = [
"owner",
"agent",
// Legacy roles (read-only, for historical memo access)
"project-manager",
"researcher",
"planner",
"builder",
"reviewer",
"process-engineer",
] as const;
export type RoleSlug = (typeof VALID_ROLES)[number];
/** Map display names to directory slugs */
export const ROLE_SLUG_MAP: Record<string, RoleSlug> = {
owner: "owner",
agent: "agent",
// Legacy mappings (for reading historical memos)
"project manager": "project-manager",
"project-manager": "project-manager",
researcher: "researcher",
planner: "planner",
builder: "builder",
reviewer: "reviewer",
"process engineer": "process-engineer",
"process-engineer": "process-engineer",
};
/**
* Valid values for the "from" field in memo frontmatter.
* Includes both directory-level roles and sub-agent names.
* Sub-agent names are allowed in "from" to identify memo authors,
* but memos are always stored in "agent" or "owner" directories.
*/
export const VALID_FROM_NAMES: readonly string[] = [
// Directory roles
"owner",
"agent",
// Sub-agent identifiers (for memo authorship tracking)
"researcher",
"planner",
"builder",
"reviewer",
"content-ideator",
"blog-writer",
// Legacy roles
"project-manager",
"process-engineer",
];
受入基準:
-
agentが VALID_ROLES に含まれている - VALID_FROM_NAMES が定義されている
- 既存テストがすべてパスする
Step 1.3: scripts/memo/commands/create.ts の更新
ファイル: /home/ena/yolo-web/scripts/memo/commands/create.ts
変更内容: (1) from の検証に VALID_FROM_NAMES を使用する(ディレクトリ解決は to のみ)、(2) CLAUDECODE=1 環境変数を検知して owner なりすましを防止する。
変更後の完全な内容:
import fs from "node:fs";
import path from "node:path";
import { generateMemoId } from "../core/id.js";
import { formatTimestamp, serializeFrontmatter } from "../core/frontmatter.js";
import { resolveRoleSlug, memoFilePath } from "../core/paths.js";
import { checkCredentials } from "../core/credential-check.js";
import { scanAllMemos } from "../core/scanner.js";
import { VALID_FROM_NAMES } from "../types.js";
import type { MemoFrontmatter } from "../types.js";
export interface CreateOptions {
subject: string;
from: string;
to: string;
tags: string[];
replyTo: string | null;
body: string;
skipCredentialCheck?: boolean;
}
/**
* Create a new memo file.
* Returns the created memo's ID.
*/
export function createMemo(options: CreateOptions): string {
const fromNormalized = options.from.toLowerCase().trim();
const toSlug = resolveRoleSlug(options.to);
// Validate "from" against allowed names
if (!VALID_FROM_NAMES.includes(fromNormalized)) {
throw new Error(
`Unknown from name: "${options.from}". Valid names: ${VALID_FROM_NAMES.join(", ")}`,
);
}
// When running inside Claude Code (CLAUDECODE=1), agents cannot
// impersonate owner. This is a deterministic guard that does not
// rely on agents voluntarily setting environment variables.
if (process.env.CLAUDECODE === "1" && fromNormalized === "owner") {
throw new Error(
"Permission denied: agents cannot create memos as owner",
);
}
// Validate body is not empty
if (!options.body || options.body.trim() === "") {
throw new Error("Body is required and cannot be empty");
}
// Credential check
if (!options.skipCredentialCheck) {
const textToCheck = `${options.subject}\n${options.body}`;
const result = checkCredentials(textToCheck);
if (result.found) {
throw new Error(
`Warning: Potential credential detected: ${result.description}\n` +
`Memo content will be public on GitHub and the website.\n` +
`If the content is safe to publish, re-run with --skip-credential-check`,
);
}
}
// Auto-add "reply" tag for replies
const tags = [...options.tags];
if (options.replyTo && !tags.includes("reply")) {
tags.unshift("reply");
}
// Generate ID and timestamp from same millisecond value
let { id, timestamp } = generateMemoId();
// Check for ID collisions
const existingMemos = scanAllMemos();
const existingIds = new Set(existingMemos.map((m) => m.frontmatter.id));
while (existingIds.has(id)) {
timestamp += 1;
id = timestamp.toString(16);
}
const frontmatter: MemoFrontmatter = {
id,
subject: options.subject,
from: fromNormalized,
to: toSlug,
created_at: formatTimestamp(timestamp),
tags,
reply_to: options.replyTo,
};
const yaml = serializeFrontmatter(frontmatter);
const content = `${yaml}\n\n${options.body}\n`;
const filePath = memoFilePath(toSlug, id, options.subject);
const dir = path.dirname(filePath);
// Ensure directory exists
fs.mkdirSync(dir, { recursive: true });
fs.writeFileSync(filePath, content, "utf-8");
return id;
}
受入基準:
-
CLAUDECODE=1環境下でfrom=ownerの作成がエラーになる -
CLAUDECODE=1環境下でfrom=agentto=ownerの作成が成功する - sub-agent名(researcher, builder等)が from に使える
- 環境変数未設定時は制限なし
Step 1.4: scripts/memo/commands/mark.ts の owner保護強制
ファイル: /home/ena/yolo-web/scripts/memo/commands/mark.ts
変更後の完全な内容:
import fs from "node:fs";
import path from "node:path";
import { scanAllMemos, type MemoState } from "../core/scanner.js";
const VALID_STATES: MemoState[] = ["inbox", "active", "archive"];
/**
* Change a memo's state by moving it to the corresponding directory.
* Outputs: "<id>: <old_state> -> <new_state>"
*/
export function markMemo(id: string, newState: MemoState): void {
if (!VALID_STATES.includes(newState)) {
throw new Error(
`Invalid state: "${newState}". Valid states: ${VALID_STATES.join(", ")}`,
);
}
const memos = scanAllMemos();
const memo = memos.find((m) => m.frontmatter.id === id);
if (!memo) {
throw new Error(`No memo found with ID: ${id}`);
}
// When running inside Claude Code (CLAUDECODE=1), agents cannot
// change state of owner memos. This is a deterministic guard.
if (process.env.CLAUDECODE === "1") {
const roleDir = path.basename(path.dirname(path.dirname(memo.filePath)));
if (roleDir === "owner") {
throw new Error(
"Permission denied: agents cannot change state of owner memos",
);
}
}
const oldState = memo.state;
if (oldState === newState) {
console.log(`${id}: ${oldState} -> ${newState}`);
return;
}
// Compute new file path by replacing the state directory
const oldDir = path.dirname(memo.filePath);
const fileName = path.basename(memo.filePath);
const roleDir = path.dirname(oldDir); // Go up from inbox/active/archive to role dir
const newDir = path.join(roleDir, newState);
// Ensure destination directory exists
fs.mkdirSync(newDir, { recursive: true });
const newFilePath = path.join(newDir, fileName);
fs.renameSync(memo.filePath, newFilePath);
console.log(`${id}: ${oldState} -> ${newState}`);
}
受入基準:
-
CLAUDECODE=1環境下で owner メモの mark がエラーになる -
CLAUDECODE=1環境下で agent メモの mark が成功する - 環境変数未設定時は従来通り制限なし
Step 1.5: /memos ページのビルドパイプライン更新
/memos ページへの影響: src/lib/memos.ts は ROLE_SLUGS 配列でスキャン対象ディレクトリを決定している。新しい agent ディレクトリもスキャン対象に含める必要がある。
ファイル: /home/ena/yolo-web/src/lib/memos-shared.ts
変更後の完全な内容:
/**
* Shared memo types and constants that can be used in both
* server components and client components (no Node.js dependencies).
*/
export type RoleSlug =
| "owner"
| "agent"
| "project-manager"
| "researcher"
| "planner"
| "builder"
| "reviewer"
| "process-engineer";
/** Role display configuration */
export interface RoleDisplay {
label: string;
color: string;
icon: string;
}
export const ROLE_DISPLAY: Record<RoleSlug, RoleDisplay> = {
agent: {
label: "Agent",
color: "#8b5cf6",
icon: "bot",
},
"project-manager": {
label: "PM",
color: "#2563eb",
icon: "clipboard",
},
researcher: {
label: "Researcher",
color: "#16a34a",
icon: "search",
},
planner: {
label: "Planner",
color: "#9333ea",
icon: "drafting-compass",
},
builder: {
label: "Builder",
color: "#ea580c",
icon: "hammer",
},
reviewer: {
label: "Reviewer",
color: "#dc2626",
icon: "eye",
},
owner: {
label: "Owner",
color: "#6b7280",
icon: "user",
},
"process-engineer": {
label: "Process Engineer",
color: "#0891b2",
icon: "gear",
},
};
export interface PublicMemo {
id: string;
subject: string;
from: RoleSlug;
to: RoleSlug;
created_at: string;
tags: string[];
reply_to: string | null;
contentHtml: string;
threadRootId: string;
replyCount: number;
}
ファイル: /home/ena/yolo-web/src/lib/memos.ts
変更箇所: ROLE_SLUGS 配列と normalizeRole 関数に "agent" を追加する。
具体的には、L10の配列を以下に変更:
const ROLE_SLUGS: RoleSlug[] = [
"owner",
"agent",
"project-manager",
"researcher",
"planner",
"builder",
"reviewer",
"process-engineer",
];
normalizeRole 関数(L45-55)を以下に変更:
function normalizeRole(role: string): RoleSlug {
const slug = role.toLowerCase().replace(/\s+/g, "-") as RoleSlug;
if (ROLE_SLUGS.includes(slug)) return slug;
// Fallback: try common variations
const map: Record<string, RoleSlug> = {
"project manager": "project-manager",
"process engineer": "process-engineer",
chatgpt: "owner",
// Sub-agent names map to "agent" for display
"content-ideator": "agent",
"blog-writer": "agent",
};
return map[role.toLowerCase()] || ("agent" as RoleSlug);
}
受入基準:
-
npm run buildが成功する - /memos ページが agent ディレクトリのメモも含めてレンダリングする
- 既存のロール別メモが引き続き表示される
- TypeScript の型エラーがない
Step 1.6: メモシステムのテスト更新
変更内容: 既存テストを更新し、新しいテストケースを追加する。
更新が必要なテストファイル:
scripts/memo/__tests__/create.test.ts: agent ロールの create テスト追加、CLAUDECODE 環境変数による owner 保護テスト追加、sub-agent 名の from テスト追加scripts/memo/__tests__/mark.test.ts: CLAUDECODE 環境変数による owner 保護テスト追加scripts/memo/__tests__/paths.test.ts: agent ロールの解決テスト追加
追加テストケース(create.test.ts に追加):
describe("CLAUDECODE protection", () => {
beforeEach(() => {
process.env.CLAUDECODE = "1";
});
afterEach(() => {
delete process.env.CLAUDECODE;
});
test("rejects creating memo as owner when CLAUDECODE=1", () => {
expect(() =>
createMemo({
from: "owner",
to: "agent",
subject: "test",
body: "test body",
tags: [],
replyTo: null,
}),
).toThrow("Permission denied: agents cannot create memos as owner");
});
test("allows creating memo as agent when CLAUDECODE=1", () => {
const id = createMemo({
from: "agent",
to: "agent",
subject: "test",
body: "test body",
tags: [],
replyTo: null,
});
expect(id).toBeTruthy();
});
test("allows sub-agent name in from field", () => {
const id = createMemo({
from: "researcher",
to: "agent",
subject: "test",
body: "test body",
tags: [],
replyTo: null,
});
expect(id).toBeTruthy();
});
});
追加テストケース(mark.test.ts に追加):
describe("CLAUDECODE protection", () => {
beforeEach(() => {
process.env.CLAUDECODE = "1";
});
afterEach(() => {
delete process.env.CLAUDECODE;
});
test("rejects marking owner memo when CLAUDECODE=1", () => {
// Setup: create a memo in memo/owner/inbox/ for testing
expect(() => markMemo(ownerMemoId, "archive")).toThrow(
"Permission denied: agents cannot change state of owner memos",
);
});
test("allows marking agent memo when CLAUDECODE=1", () => {
// Should succeed without error
markMemo(agentMemoId, "archive");
});
});
受入基準:
-
npm testが全テストパス - agent ロールの create/mark/list テストが存在する
- CLAUDECODE 保護のテストが存在する
- sub-agent 名の from フィールドテストが存在する
フェーズ2: CLAUDE.md の簡素化と .claude/rules/ への分離
Step 2.1: .claude/rules/ ディレクトリの作成と内容
新規作成ファイル一覧: 5つのファイル(元プランの4つ + main-agent.md)
ファイル 2.1a: /home/ena/yolo-web/.claude/rules/memo-system.md
# Memo System
All work decisions and progress are recorded as memos.
## Directory Structure
- `memo/agent/` -- shared inbox for all agent work
- `memo/owner/` -- owner communications (read-only for agents)
- `memo/<legacy-role>/` -- historical memos (read-only archive)
## Memo CLI
All memo operations use `npm run memo`:
- `npm run memo -- list [--state inbox|active|archive|all] [--to agent|owner] [--from <name>] [--tag <tag>] [--limit <n>] [--fields <fields>]`
- `npm run memo -- read <id>`
- `npm run memo -- create <from> <to> <subject> --body "<body>" [--reply-to <id>] [--tags <tags>] [--skip-credential-check]`
- `npm run memo -- mark <id> <state>`
Direct manipulation of `memo/` directory files is prohibited. Use the CLI only.
## Memo Lifecycle
1. Check agent inbox and active at work start
2. Read each memo, triage: archive (done/informational) or activate (ongoing)
3. Respond by creating a reply memo with `--reply-to`
4. Triage all inbox memos before concluding work
## Routing
- Sub-agent to sub-agent: from=<sub-agent-name>, to=agent
- Reports to owner: from=agent (or sub-agent name), to=owner
- Owner instructions: from=owner, to=agent
## From Field
The `from` field accepts sub-agent names (researcher, planner, builder, reviewer, content-ideator, blog-writer) to identify the memo's author. Memos are always stored in `agent` or `owner` directories regardless of the from value.
## 1 Memo = 1 Task
Each memo contains exactly one work request. Multiple tasks require separate memos.
## Detailed Specification
For ID format, file naming, YAML frontmatter fields, and templates, see `docs/memo-spec.md`.
## Historical Memos
Legacy role-based memos (builder/, planner/, etc.) remain as read-only archives. Query them with `npm run memo -- list --to <legacy-role>`.
ファイル 2.1b: /home/ena/yolo-web/.claude/rules/coding-standards.md
---
paths:
- "src/**/*.{ts,tsx}"
- "scripts/**/*.ts"
---
# Coding Standards
## TypeScript
- Strict mode enabled. Prefer type aliases over interfaces.
- Explicit return types for public APIs. Avoid `any`.
## Style
- Prettier: double quotes, semicolons, 2-space indent, trailing commas, 80 char width.
- ESLint: next/core-web-vitals + typescript + prettier config.
## Quality Checks
Before committing, all checks must pass:
```bash
npm run typecheck && npm run lint && npm run format:check && npm test && npm run build
Architecture
- Static-first: prefer static content and build-time generation. No databases.
- No user accounts or authentication.
- Small, composable modules. Narrow components, independently testable.
- All site content is AI-owned. AI experiment disclosure is mandatory (Constitution Rule 3).
- Google Analytics is used as a page view metric for the project goal.
Testing
- Vitest + jsdom + @testing-library/react
- Test files:
__tests__/<filename>.test.ts(x)alongside source - Test: utilities, component rendering, data transforms, edge cases
**ファイル 2.1c**: `/home/ena/yolo-web/.claude/rules/cycle-management.md`
```markdown
# Cycle Management
Each cycle represents a unit of work (feature, content addition, redesign).
## Cycle Document
Every cycle creates a tracking document at `docs/cycles/<cycle-number>.md` using the template at `.claude/skills/cycle-template/SKILL.md`.
## Lifecycle
1. **Kickoff**: Select work from backlog, create cycle document, report to owner
2. **Research**: Delegate investigation to research-focused sub-agents
3. **Plan**: Delegate planning to planning-focused sub-agents
4. **Build**: Delegate implementation to builder sub-agents (parallelize when areas do not overlap)
5. **Review**: Every build output must pass review before shipping
6. **Ship**: Commit, push to main (auto-deploys via Vercel), report to owner
## Blog Articles
Create a blog article when any cycle includes: new service type, bulk content addition, major site change, or significant learnings. See `.claude/skills/blog-article-writing/SKILL.md` for detailed criteria and format.
## Lightweight Fix Exception
Bug fixes, typo corrections, and reviewer notes can skip the research/plan/review-plan phases and go directly to build. Conditions: scope is clear and limited, no new features or content, review-implementation phase is still required.
## Backlog
Maintained at `docs/backlog.md`. Updated at cycle start and completion.
ファイル 2.1d: /home/ena/yolo-web/.claude/rules/git-conventions.md
# Git Conventions
## Commit Author
Set `--author "Claude <noreply@anthropic.com>"` or `--author "Codex <codex@localhost>"` on all commits.
## Commit Freely
Commits do not require owner approval. Commit frequently to create rollback checkpoints.
## Deploy
Push to `main` triggers Vercel auto-deploy. Rollback via `git revert <commit>`.
ファイル 2.1e: /home/ena/yolo-web/.claude/rules/main-agent.md(新規、Major 2.2 対応)
# Main Agent Responsibilities
The main agent orchestrates all work through sub-agents and memos.
## Core Duties
- Check `memo/agent/inbox/` and `memo/agent/active/` at work start
- Triage memos: archive completed items, activate ongoing tasks
- Select work from `docs/backlog.md` and delegate to appropriate sub-agents
- Coordinate sub-agent work through memos (assign specific memo IDs when launching)
- Send progress reports and completion reports to owner via `memo/owner/inbox/`
- Edit `docs/backlog.md` directly when updating task status
## Sub-Agent Dispatch
1. Create a memo describing the task: `npm run memo -- create agent agent "<subject>" --body "<details>"`
2. Launch the appropriate sub-agent (researcher, planner, builder, reviewer, content-ideator, blog-writer)
3. Each sub-agent works only on its assigned memo(s)
4. Wait for completion report memos before proceeding
## Delegation Scope
The main agent delegates all implementation work:
- Investigation and analysis: delegate to researcher
- Detailed plans and specifications: delegate to planner
- Code changes and file creation: delegate to builder
- Quality review: delegate to reviewer
- Content ideas: delegate to content-ideator
The main agent's own scope is limited to: memo triage, strategic decisions, priority setting, sub-agent coordination, and backlog maintenance.
## Quality Gate
Every build output must be reviewed and approved before shipping. Launch the reviewer sub-agent with the builder's completion memo ID to request review.
受入基準:
- 5つの .claude/rules/*.md ファイルが存在する
- coding-standards.md に paths フロントマターがある
- main-agent.md にメインエージェントの責務が定義されている
- cycle-management.md に軽微修正の例外規定がある
- coding-standards.md の Architecture セクションに analytics 情報がある
Step 2.2: CLAUDE.md の書き換え(60行以内)
ファイル: /home/ena/yolo-web/CLAUDE.md
変更後の全内容 (54行):
# yolos.net
AI-operated experimental website aiming to increase page views.
## Constitution
`docs/constitution.md` is immutable. Every action and content must comply with it. Read it first.
## Core Workflow
1. Record all decisions and work as memos (`npm run memo`). See `.claude/rules/memo-system.md`.
2. Use specialized sub-agents (`.claude/agents/`) and skills (`.claude/skills/`) for all work.
3. Reports to owner go to `memo/owner/inbox/`. Agent coordination uses `memo/agent/inbox/`.
4. Every build output passes review before shipping.
5. Parallelize independent tasks. Commit frequently for rollback safety.
## Sub-Agent Dispatch
Assign specific memo IDs when launching sub-agents. Each sub-agent works only on its assigned memo(s).
## Toolchain
Next.js / TypeScript / ESLint / Prettier / Vitest + jsdom
## Key References
- `.claude/rules/` -- Detailed rules (memo system, coding standards, cycles, git, main agent)
- `.claude/skills/` -- Reusable task procedures (blog writing, cycle management, etc.)
- `.claude/agents/` -- Specialized sub-agent definitions
- `docs/constitution.md` -- Immutable project rules
- `docs/backlog.md` -- Product backlog (main agent may edit directly)
- `docs/memo-spec.md` -- Detailed memo format specification
受入基準:
- CLAUDE.md が60行以内である
- 否定形の指示が含まれていない(肯定形のみ)
- constitution.md への参照がある
- メモシステム、sub-agent、skills への参照がある
- memo-spec.md への参照がある
フェーズ3: Sub-Agent定義の再構築
Step 3.1: 既存の4つのロールベースagent定義を削除
削除するファイル:
/home/ena/yolo-web/.claude/agents/researcher.md/home/ena/yolo-web/.claude/agents/planner.md/home/ena/yolo-web/.claude/agents/builder.md/home/ena/yolo-web/.claude/agents/reviewer.md
Step 3.2: 新しい専門sub-agent定義の作成
以下の6つのsub-agentを作成する。
ファイル 3.2a: /home/ena/yolo-web/.claude/agents/researcher.md
---
name: researcher
description: "Investigates the codebase and internet for accurate, relevant information. Use for any research or information gathering task."
tools: Read, Glob, Grep, Bash, WebFetch, WebSearch
disallowedTools: Edit, Write, MultiEdit
model: inherit
permissionMode: bypassPermissions
memory: project
---
# Researcher
You investigate and provide accurate information.
## Instructions
1. Read `docs/constitution.md` (immutable rules) and `.claude/rules/memo-system.md`.
2. Check assigned memo(s) with `npm run memo -- read <id>`.
3. Investigate the repository and/or internet as needed.
4. Report findings as a reply memo: `npm run memo -- create researcher agent "Re: <subject>" --reply-to <id> --body "<findings>"`
5. Include: questions answered, sources inspected, confidence level, unknowns.
6. For owner-relevant findings, also send a summary to owner: `npm run memo -- create researcher owner "<subject>" --body "<summary>"`
## Constraints
- Read-only: gather and report information only. Implementation and planning belong to other agents.
ファイル 3.2b: /home/ena/yolo-web/.claude/agents/planner.md
---
name: planner
description: "Creates detailed implementation plans with exact specifications. Use for planning features, architecture decisions, and task breakdowns."
tools: Read, Glob, Grep, Bash, WebFetch, WebSearch
disallowedTools: Edit, Write, MultiEdit
model: inherit
permissionMode: bypassPermissions
memory: project
---
# Planner
You create reliable, detailed implementation plans.
## Instructions
1. Read `docs/constitution.md` (immutable rules) and `.claude/rules/memo-system.md`.
2. Check assigned memo(s) with `npm run memo -- read <id>`.
3. Create a step-by-step plan with acceptance criteria for each step.
4. Plans must be specific enough for a builder agent to implement without ambiguity.
5. Send the plan as a reply memo: `npm run memo -- create planner agent "Re: <subject>" --reply-to <id> --body "<plan>"`
6. After planning, request review by creating a review-request memo.
## Plan Format
Include: Goal, Step-by-step plan, Acceptance criteria per step, Required artifacts, Rollback approach.
## Constraints
- Read-only: create plans only. Implementation belongs to builder agents.
ファイル 3.2c: /home/ena/yolo-web/.claude/agents/builder.md
---
name: builder
description: "Implements plans and tasks exactly as instructed. Use for code changes, file creation, dependency installation, and build tasks."
tools: Read, Edit, Write, MultiEdit, Bash, Glob, Grep
model: inherit
permissionMode: bypassPermissions
memory: project
skills:
- blog-article-writing
---
# Builder
You implement reliably, exactly as instructed.
## Instructions
1. Read `docs/constitution.md` (immutable rules) and `.claude/rules/memo-system.md`.
2. Check assigned memo(s) with `npm run memo -- read <id>`.
3. Implement the plan/task within the memo's acceptance criteria scope.
4. Run all quality checks before reporting completion:
```bash
npm run typecheck && npm run lint && npm run format:check && npm test && npm run build
- Send completion report:
npm run memo -- create builder agent "Re: <subject>" --reply-to <id> --body "<report>" - Request review by creating a review-request memo for the reviewer agent.
Completion Report Format
Include: what was implemented, changed files list, quality check results, how to validate.
Constraints
- Keep changes scoped to the memo's acceptance criteria.
- Commit with
--author "Claude <noreply@anthropic.com>".
**ファイル 3.2d**: `/home/ena/yolo-web/.claude/agents/reviewer.md`
```markdown
---
name: reviewer
description: "Reviews code, plans, and documents for correctness, quality, and constitution compliance. Use for all review tasks."
tools: Read, Glob, Grep, Bash
disallowedTools: Edit, Write, MultiEdit
model: inherit
permissionMode: bypassPermissions
memory: project
---
# Reviewer
You find all problems.
## Instructions
1. Read `docs/constitution.md` (immutable rules).
2. Check assigned memo(s) with `npm run memo -- read <id>`.
3. Review for: correctness, clarity, maintainability, constitution compliance.
4. Reply with verdict: `npm run memo -- create reviewer agent "Re: <subject>" --reply-to <id> --body "<review>"`
## Review Format
Include: verdict (approved/changes-requested/rejected), specific issues (file paths, line numbers), constitution compliance check, actionable feedback.
## Constraints
- Read-only: review and report only.
ファイル 3.2e: /home/ena/yolo-web/.claude/agents/content-ideator.md(新規)
---
name: content-ideator
description: "Generates ideas for new website content, tools, games, and features based on SEO potential and user value. Use when brainstorming what to build next."
tools: Read, Glob, Grep, Bash, WebFetch, WebSearch
disallowedTools: Edit, Write, MultiEdit
model: inherit
permissionMode: bypassPermissions
memory: project
---
# Content Ideator
You generate creative, actionable content ideas that drive page views.
## Instructions
1. Read `docs/constitution.md` (immutable rules).
2. Check assigned memo(s) with `npm run memo -- read <id>`.
3. Analyze the current site content (`src/content/`, `src/app/`) to understand existing offerings.
4. Research SEO opportunities, trending topics, and competitor sites.
5. Propose ideas with: title, description, target audience, estimated SEO impact, implementation complexity.
6. Reply with ideas: `npm run memo -- create content-ideator agent "Re: <subject>" --reply-to <id> --body "<ideas>"`
## Constraints
- Read-only: propose ideas only.
ファイル 3.2f: /home/ena/yolo-web/.claude/agents/blog-writer.md(新規)
---
name: blog-writer
description: "Writes blog articles about site changes, decisions, and learnings. Use when a cycle requires a blog post."
tools: Read, Edit, Write, Bash, Glob, Grep
model: inherit
permissionMode: bypassPermissions
memory: project
skills:
- blog-article-writing
---
# Blog Writer
You write engaging, informative blog articles for yolos.net.
## Instructions
1. Read `docs/constitution.md` (immutable rules).
2. Check assigned memo(s) with `npm run memo -- read <id>`.
3. Follow the blog-article-writing skill for format and requirements.
4. Include AI experiment disclosure (Constitution Rule 3).
5. Send completion report: `npm run memo -- create blog-writer agent "Re: <subject>" --reply-to <id> --body "<report>"`
## Constraints
- Scope changes to blog content files only (`src/content/blog/`).
- Commit with `--author "Claude <noreply@anthropic.com>"`.
受入基準:
- 6つのagent定義ファイルが .claude/agents/ に存在する
- researcher, planner, reviewer, content-ideator に disallowedTools: Edit, Write, MultiEdit が設定されている
- builder, blog-writer に skills フィールドがある
- 全agentに memory: project が設定されている(content-ideator を含む)
- 全agentのmemo操作で from にsub-agent名を使用する指示がある
フェーズ4: Skills の拡充とドキュメント移行
Step 4.1: サイクルテンプレートSkillの作成(新規)
ファイル: /home/ena/yolo-web/.claude/skills/cycle-template/SKILL.md
---
name: cycle-template
description: "サイクルドキュメントのテンプレート。新サイクル開始時にこのテンプレートをコピーして docs/cycles/<number>.md を作成する。"
disable-model-invocation: true
---
# Cycle Document Template
Copy this template to `docs/cycles/<cycle-number>.md` and fill in the details.
## Template
\`\`\`markdown
# Cycle <NUMBER>: <TITLE>
## Status: <in-progress|completed|cancelled>
## Goal
<What this cycle aims to achieve>
## Pre-flight Checklist
- [ ] Previous cycle completed or carry-over items logged in backlog
- [ ] Agent inbox triaged
- [ ] CodeQL alerts checked: \`gh api --method GET '/repos/macrat/yolo-web/code-scanning/alerts?state=open'\`
- [ ] Dependabot PRs checked: \`gh pr list --author 'app/dependabot'\`
- [ ] Backlog reviewed and cycle items marked as in-progress
- [ ] Owner notified of cycle start
## Research
| Topic | Memo ID | Status |
|-------|---------|--------|
| | | |
## Plan
| Item | Plan Memo ID | Review Status |
|------|-------------|---------------|
| | | |
## Build
| Item | Builder Memo ID | Review Status | Commit |
|------|----------------|---------------|--------|
| | | | |
## Completion Checklist
- [ ] All quality checks pass (typecheck, lint, format, test, build)
- [ ] All reviews approved
- [ ] Blog article created (if applicable)
- [ ] Backlog updated
- [ ] Changes pushed to main
- [ ] Owner notified of cycle completion
\`\`\`
受入基準:
- cycle-template/SKILL.md が存在する
- disable-model-invocation: true が設定されている
- テンプレートにpre-flightチェックリストと完了チェックリストが含まれる
Step 4.2: cycle-kickoff Skill の更新
ファイル: /home/ena/yolo-web/.claude/skills/cycle-kickoff/SKILL.md
変更後の完全な内容:
---
name: cycle-kickoff
description: "新しいサイクルを開始する。前回までのサイクルを確認し、次のサイクルで取り組む内容を計画して作業に着手する。サイクルを開始するときは必ず実行すること。"
---
# サイクル開始手順
## 開始手順
以下の手順に従って新しいサイクルを開始してください。
### 1. 状態の確認
前回のサイクルが完了していることを確認してください。
以下のコマンドでメモを確認し、さらに `/docs/backlog.md` に実行中のタスクがないか確認してください。
\`\`\`bash
npm run memo -- list --to agent --state inbox # 新しく届いているメモがないか確認
npm run memo -- list --to agent --state active # まだ作業中のメモがないか確認
\`\`\`
前回のサイクルが完了していない場合は、まずはそちらを完了させてください。
### 2. メモのトリアージ
agent inboxを確認し、届いているメモがあればトリアージしてください。
\`\`\`bash
npm run memo -- list --to agent --state inbox
\`\`\`
新たなタスクが発生している場合は、`/docs/backlog.md`のQueuedまたはDeferredに追加してください。
### 3. Pre-flightチェック
以下のチェックを実施してください。
\`\`\`bash
# CodeQLアラートの確認
gh api --method GET '/repos/macrat/yolo-web/code-scanning/alerts?state=open'
# Dependabot PRの確認
gh pr list --author 'app/dependabot'
\`\`\`
- Critical/High アラート: 即座にバックログ Active に追加し優先対応
- Dependabot パッチ更新(CI通過済み): reviewer確認後マージ
### 4. Backlogの更新
`/docs/backlog.md` を確認し、Deferredに分類されている項目のうち着手可能になっているものがあればQueuedに移動してください。
### 5. 実施する作業の選択
`/docs/backlog.md` を確認し、Queuedに分類されている項目から着手するものを選んでActiveに移動してください。
すぐに終わるような簡単なタスクや、同時にやった方が効率が良いタスクがあれば、複数をまとめて選んでも構いません。
着手できる項目がない場合は、`/docs/cycle-catalog/`にあるサイクル案のなかから1つ選んで、次に実行するものを決めてください。
あるいは、新しいサイクル案を作成してそれを採用しても構いません。
### 6. サイクルドキュメントの作成
`.claude/skills/cycle-template/SKILL.md` のテンプレートをコピーして `docs/cycles/<cycle-number>.md` を作成してください。
サイクル番号は直前のサイクルの番号 + 1 としてください。
### 7. ownerへの開始報告
実施するサイクルの内容が決まったら、owner宛てにサイクル開始報告のメモを送ってください。メモには、サイクル番号、サイクルの内容、採用したサイクル案のID(ある場合)を含めてください。
\`\`\`bash
npm run memo -- create agent owner "サイクルN開始報告" --body "## サイクル内容\n\n..."
\`\`\`
## 注意事項
- 作業はすべてサブエージェントに任せ、メインエージェントは全体の管理と調整に専念してください。
- サブエージェントとのやり取りはすべてメモを通じて行ってください。
- サイクルの各ステップ(開始・作業・完了)はownerの許可を待たずに自律的に進めること。サイクル内のすべてのタスクが完了したら、ownerに確認を求めることなく、直ちにサイクル完了手順(`/cycle-completion`)に進むこと。
受入基準:
- agent/owner のメモルーティングを使用している
- cycle-template への参照がある
- docs/cycles/ ディレクトリへのドキュメント作成手順がある
- Pre-flightチェック(CodeQL、Dependabot)が含まれている
Step 4.3: cycle-completion Skill の更新
ファイル: /home/ena/yolo-web/.claude/skills/cycle-completion/SKILL.md
変更後の完全な内容:
---
name: cycle-completion
description: "サイクルの成果をownerに報告し、サイクルを完了させるための作業。サイクルで計画したタスクがすべて完了したら、必ずこのスキルを実行すること。"
---
# サイクル完了手順
サイクルの全タスクが完了したら、以下の手順を順番に実行してください。
## 1. 実装完了確認
すべてのチェックが通ることを確認してください。1つでも失敗した場合は、修正してから次に進んでください。
\`\`\`bash
npm run typecheck
npm run lint
npm run format:check
npm test
npm run build
\`\`\`
## 2. レビュー確認
### 2a. レビュー完了チェック
agent inbox/active にレビュー関連のメモが残っていないことを確認してください。
\`\`\`bash
npm run memo -- list --to agent --state inbox
npm run memo -- list --to agent --state active
\`\`\`
### 2b. レビュー承認の確認
- 今回作業した内容について、reviewer からの承認メモが存在することを確認してください。
- 未対応の reviewer 指摘事項がないことを確認してください。
- reviewer から指摘事項がある場合は、すべて対応してから次に進んでください。
> **注記**: reviewer へレビュー依頼を転送する際は、1メモ1タスク原則を遵守すること。
## 3. ブログ記事確認
サイクルで新機能や新サービスを追加した場合、ブログ記事の作成は**必須**である。以下を確認してください。
- 新機能・新サービスの追加、またはコンテンツの大幅追加を行った場合、対応するブログ記事が作成されていること。作成されていない場合は、blog-writer に作成を依頼してから次に進むこと。
- ブログ記事がビルドに含まれていることを確認する。
\`\`\`bash
npm run build
\`\`\`
- ブログ記事の `draft` フロントマターが `false` になっていることを確認する。
## 4. サイクルドキュメントの更新
`docs/cycles/<cycle-number>.md` の完了チェックリストを更新してください。
## 5. バックログ更新
`/docs/backlog.md` を更新してください。
- サイクルで完了した項目を **Done** セクションに移動する。
- 古い完了項目を削除して、直近5サイクル分のみを残す。
- キャリーオーバー項目(未完了で次サイクルに持ち越す項目)があれば **Queued** セクションに移動する。
- 新たに発見されたタスクがあれば **Queued** または **Deferred** セクションに追加する。
## 6. ownerへの完了報告
owner宛てにサイクル完了報告メモを作成してください。
\`\`\`bash
npm run memo -- create agent owner "サイクルN完了報告" --reply-to <開始報告メモID> --body "## 完了タスク\n\n..."
\`\`\`
報告メモには以下の内容を含めてください。
- 完了したタスクの一覧
- 各タスクの成果物(作成・変更したファイル)
- テスト結果のサマリー(テスト数、ビルドページ数)
- レビュー結果のサマリー
- 未完了・キャリーオーバー項目があればその説明
## 7. 最後のフォーマット
コミット前に、最終のフォーマットを行ってください。
\`\`\`bash
npm run format
\`\`\`
## 8. コミットとプッシュ
すべての変更をmainブランチにコミットしてプッシュしてください。
これにより、サイクルの成果がデプロイされます。
受入基準:
- agent/owner のメモルーティングを使用している
- サイクルドキュメントの完了チェックリスト更新手順がある
- レビュー確認が agent inbox/active ベースになっている
Step 4.4: blog-article-writing Skill の更新
ファイル: /home/ena/yolo-web/.claude/skills/blog-article-writing/SKILL.md
変更内容: L8の「docs/workflow.md」への参照を削除する。このSKILLは既にブログ記事の作成基準を完全に含んでいるため、workflow.md への参照は不要になる。
変更箇所: L8 を以下に置き換え:
> このSkillはブログ記事作成の完全な手順を定義するものです。
受入基準:
- workflow.md への参照が削除されている
- ブログ記事作成基準が引き続き含まれている
Step 4.5: docs/ の整理
削除するファイル(内容が .claude/rules/ や .claude/skills/ に移行済み):
/home/ena/yolo-web/docs/workflow.md-- 内容は .claude/rules/ と agent 定義に分散/home/ena/yolo-web/docs/style.md-- 内容は .claude/rules/coding-standards.md に統合/home/ena/yolo-web/docs/testing.md-- 内容は .claude/rules/coding-standards.md に統合/home/ena/yolo-web/docs/deploy.md-- 内容は .claude/rules/git-conventions.md に統合
残すファイル:
docs/constitution.md-- 不変(絶対に変更しない)docs/backlog.md-- main agentが直接編集するバックログdocs/architecture.md-- サイトコンテンツセクションの情報は固有docs/setup.md-- セットアップ手順(人間の開発者向け)docs/README.md-- プロジェクト概要(確認済、35行)docs/memo-spec.md-- 詳細メモ仕様(Critical 1.2 対応、削除しない)docs/analytics.md-- アナリティクス方針(Critical 1.3 対応、削除しない)docs/index.md-- 更新が必要docs/cycle-catalog/-- そのまま残す
更新するファイル:
/home/ena/yolo-web/docs/index.md を以下に更新:
# ドキュメント一覧
## 不変ポリシー
- [Constitution](constitution.md) -- プロジェクトの不変ルール
## プロジェクトドキュメント
- [README](README.md) -- プロジェクト概要
- [アーキテクチャ](architecture.md) -- サイト構成とコンテンツセクション
- [セットアップ](setup.md) -- 開発環境セットアップ手順
- [バックログ](backlog.md) -- プロダクトバックログ
- [メモ仕様](memo-spec.md) -- メモフォーマット、ID仕様、テンプレート
- [アナリティクス](analytics.md) -- Google Analytics利用方針
## エージェント設定(.claude/ 配下)
- `.claude/rules/` -- 詳細ルール(メモシステム、コーディング規約、サイクル管理、Git規約、メインエージェント)
- `.claude/skills/` -- 再利用可能な手順(ブログ記事作成、サイクル管理等)
- `.claude/agents/` -- 専門サブエージェント定義
受入基準:
- 削除対象の4ファイル(workflow.md, style.md, testing.md, deploy.md)が存在しない
- memo-spec.md と analytics.md が残っている
- docs/index.md が更新されている
フェーズ5: Hooks による確定的な制約強制
Step 5.1: .claude/settings.json の更新
ファイル: /home/ena/yolo-web/.claude/settings.json
変更後の完全な内容:
{
"$schema": "https://json.schemastore.org/claude-code-settings.json",
"permissions": {
"allow": ["Bash", "WebFetch"],
"deny": [
"Edit(/docs/constitution.md)",
"Write(/docs/constitution.md)",
"MultiEdit(/docs/constitution.md)"
]
},
"hooks": {
"PreToolUse": [
{
"matcher": "Bash",
"hooks": [
{
"type": "command",
"command": "\"$CLAUDE_PROJECT_DIR\"/.claude/hooks/pre-commit-check.sh"
}
]
},
{
"matcher": "Write|Edit|MultiEdit",
"hooks": [
{
"type": "command",
"command": "\"$CLAUDE_PROJECT_DIR\"/.claude/hooks/protect-constitution.sh"
}
]
},
{
"matcher": "Bash",
"hooks": [
{
"type": "command",
"command": "\"$CLAUDE_PROJECT_DIR\"/.claude/hooks/protect-memo-direct.sh"
}
]
}
],
"SubagentStop": [
{
"matcher": "builder|blog-writer",
"hooks": [
{
"type": "command",
"command": "\"$CLAUDE_PROJECT_DIR\"/.claude/hooks/check-review-before-ship.sh"
}
]
}
]
},
"defaultMode": "acceptEdits"
}
Step 5.2: constitution.md 保護フック(新規)
ファイル: /home/ena/yolo-web/.claude/hooks/protect-constitution.sh
完全な内容:
#!/bin/bash
# Hook: Prevent modification of docs/constitution.md via Write/Edit/MultiEdit tools.
# This is a defense-in-depth measure alongside the deny list in settings.json.
INPUT=$(cat)
FILE_PATH=$(echo "$INPUT" | jq -r '.tool_input.file_path // .tool_input.file // empty')
if [ -z "$FILE_PATH" ]; then
exit 0
fi
# Resolve to absolute path for comparison
ABS_PATH=$(realpath "$FILE_PATH" 2>/dev/null || echo "$FILE_PATH")
CONSTITUTION=$(realpath "$CLAUDE_PROJECT_DIR/docs/constitution.md" 2>/dev/null)
if [ "$ABS_PATH" = "$CONSTITUTION" ]; then
echo "constitution.md is immutable and cannot be modified." >&2
exit 2
fi
exit 0
Step 5.3: memo/ディレクトリ直接操作防止フック(新規)
ファイル: /home/ena/yolo-web/.claude/hooks/protect-memo-direct.sh
完全な内容:
#!/bin/bash
# Hook: Prevent direct file operations on memo/ directory.
# All memo operations must go through the CLI: npm run memo
#
# Known limitations:
# - This hook only intercepts Bash tool calls with simple string matching.
# - Bypass is possible via: scripting languages (python, node), tee, dd,
# indirect shell expansion, or other non-standard commands.
# - Read operations (cat, less, grep) on memo/ are intentionally allowed.
# - This is a best-effort guard, not a security boundary.
INPUT=$(cat)
COMMAND=$(echo "$INPUT" | jq -r '.tool_input.command')
# Allow npm run memo (the CLI tool)
if echo "$COMMAND" | grep -q 'npm run memo'; then
exit 0
fi
# Block direct file write/move/delete operations on memo/ directory
# Note: mkdir is intentionally excluded because the builder may need to
# create memo directories during initial setup (Step 1.1).
if echo "$COMMAND" | grep -qE '(mv|cp|rm|touch)\s.*memo/' ; then
echo "Direct manipulation of memo/ directory is prohibited. Use 'npm run memo' CLI instead." >&2
exit 2
fi
# Block redirects into memo/
if echo "$COMMAND" | grep -qE '>.*memo/'; then
echo "Direct file writing to memo/ directory is prohibited. Use 'npm run memo' CLI instead." >&2
exit 2
fi
exit 0
Step 5.4: レビュー確認フック(新規、Major 2.3 対応)
ファイル: /home/ena/yolo-web/.claude/hooks/check-review-before-ship.sh
完全な内容:
#!/bin/bash
# Hook: SubagentStop for builder/blog-writer.
# Warns the main agent if the builder completed without a review memo.
# This is advisory (exit 0 with systemMessage), not blocking,
# because the builder may have legitimately finished and the review
# happens as a separate step. The main agent should then launch
# the reviewer before proceeding to ship.
INPUT=$(cat)
AGENT_TYPE=$(echo "$INPUT" | jq -r '.agent_type // empty')
LAST_MSG=$(echo "$INPUT" | jq -r '.last_assistant_message // empty')
# Check if the builder's last message mentions review request
if echo "$LAST_MSG" | grep -qiE 'review|レビュー'; then
exit 0
fi
# Emit a reminder as additionalContext for the main agent
cat <<EOF
{
"hookSpecificOutput": {
"hookEventName": "SubagentStop",
"additionalContext": "REMINDER: The ${AGENT_TYPE} sub-agent has completed. Verify that a review-request memo was created. Every build output must pass review before shipping. Launch the reviewer sub-agent if review has not been requested."
}
}
EOF
exit 0
Step 5.5: 新規フックファイルに実行権限を付与
chmod +x .claude/hooks/protect-constitution.sh
chmod +x .claude/hooks/protect-memo-direct.sh
chmod +x .claude/hooks/check-review-before-ship.sh
受入基準:
- .claude/settings.json が上記の内容である
- deny リストに Edit, Write, MultiEdit の constitution.md が含まれている
- protect-constitution.sh が存在し実行可能である
- protect-memo-direct.sh が存在し実行可能である
- check-review-before-ship.sh が存在し実行可能である
- protect-memo-direct.sh に限界事項のコメントがある
- protect-memo-direct.sh が mkdir をブロックしない
- SubagentStop フックが builder と blog-writer に適用される
フェーズ6: docs/cycles/ ディレクトリの初期化
Step 6.1: ディレクトリ作成
mkdir -p docs/cycles
touch docs/cycles/.gitkeep
受入基準:
- docs/cycles/ ディレクトリが存在する
実施順序と依存関係
フェーズ1(メモシステム再構築)
├── Step 1.1(ディレクトリ)
├── Step 1.2(types.ts)→ Step 1.3, 1.4 に依存される
├── Step 1.3(create.ts owner保護)
├── Step 1.4(mark.ts owner保護)
├── Step 1.5(/memos ビルドパイプライン)
└── Step 1.6(テスト更新)→ Step 1.2, 1.3, 1.4 完了後
フェーズ2(CLAUDE.md簡素化)→ フェーズ1完了後
├── Step 2.1(.claude/rules/ 作成 - 5ファイル)
└── Step 2.2(CLAUDE.md書き換え)→ Step 2.1完了後
フェーズ3(Sub-Agent再構築)→ フェーズ2完了後(rules参照のため)
├── Step 3.1(旧agent定義削除)
└── Step 3.2(新agent定義作成)→ Step 3.1と同時可
フェーズ4(Skills拡充)→ フェーズ2完了後
├── Step 4.1(cycle-template)
├── Step 4.2(cycle-kickoff更新)
├── Step 4.3(cycle-completion更新)
├── Step 4.4(blog-article-writing更新)
└── Step 4.5(docs/整理)→ Step 2.1完了後(移行先の確認)
フェーズ5(Hooks)→ フェーズ1完了後(独立して並行可能)
├── Step 5.1(settings.json)
├── Step 5.2(constitution保護)
├── Step 5.3(memo直接操作防止)
├── Step 5.4(レビュー確認フック)
└── Step 5.5(実行権限)
フェーズ6(cycles/)→ 依存なし(いつでも可能)
推奨実施順序:
- フェーズ1 (全Step)
- フェーズ5 + フェーズ6 (並行)
- フェーズ2
- フェーズ3 + フェーズ4 (並行)
各フェーズ完了時にコミットすること。
ロールバック方針
- 各フェーズは独立したコミットにするため、
git revertで個別にロールバック可能 - メモの既存データは移動・削除しないため、旧システムへの復帰は types.ts と paths.ts の revert で可能
- フェーズ2-4 のドキュメント移行は、docs/ の削除ファイルを git restore で復元し CLAUDE.md を revert すれば復帰可能
- フェーズ5 の Hooks は settings.json を revert すれば即座に無効化
全体の受入基準
- CLAUDE.md が60行以内である
- 否定形の指示がCLAUDE.mdに含まれていない
- .claude/rules/ に5つのルールファイルが存在する(memo-system, coding-standards, cycle-management, git-conventions, main-agent)
- .claude/agents/ に6つのagent定義が存在する
- researcher, planner, reviewer, content-ideator に disallowedTools が設定されている
- 全agentに memory: project が設定されている
- memo/agent/{inbox,active,archive}/ が存在する
- memo CLI で agent ロールが使用可能
- sub-agent名が from フィールドに使用可能
- CLAUDECODE=1 環境下で owner メモの mark がブロックされる
- CLAUDECODE=1 環境下で owner なりすまし create がブロックされる
- constitution.md の編集が deny リスト (Edit, Write, MultiEdit) と Hook でブロックされる
- memo/ の直接操作が Hook でブロックされる(mkdir は除外)
- SubagentStop フックが builder/blog-writer 完了時にレビューリマインダーを出す
- 既存メモがすべて保持されている
- src/lib/memos.ts と memos-shared.ts が agent ロールに対応している
- /memos ページのビルドが成功する
- docs/memo-spec.md と docs/analytics.md が残っている
- npm run typecheck, lint, format:check, test, build がすべてパス
- docs/constitution.md が変更されていない
Next actions
- このプランを reviewer に送付してレビューを受ける
- レビュー承認後、PM にプランのメモIDを報告する