feat(framework): superpowers enforcement, typecheck hook, file-ownership rules
- Add PostToolUse typecheck hook (typecheck-hook.sh) that runs tsc --noEmit after TS/TSX edits for immediate type error feedback - Add Superpowers Enforcement section to AGENTS.md requiring active use of skills, hooks, MCP tools, and plugins — not just passive availability - Add self-evolution captures (framework-improvement, tooling-gap, friction) - Add file-ownership/partitioning rules to ORCHESTRATOR.md preventing parallel worker file collisions - Add settings audit to launch.ts that validates ~/.claude/settings.json has required hooks and plugins at mosaic claude launch time - Document required Claude Code settings in RUNTIME.md Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -73,6 +73,27 @@ Spawn a worker instead. No exceptions. No "quick fixes."
|
||||
- Wait for at least one worker to complete before spawning more
|
||||
- This optimizes token usage and reduces context pressure
|
||||
|
||||
## File Ownership & Partitioning (Hard Rule for Parallel Workers)
|
||||
|
||||
When dispatching parallel workers, the orchestrator MUST assign **non-overlapping file scopes** to each worker. File collisions between parallel workers cause merge conflicts, lost edits, and wasted tokens.
|
||||
|
||||
**Rules:**
|
||||
|
||||
1. **Exclusive file ownership.** Each file may be assigned to at most one active worker. The orchestrator records ownership in the worker dispatch (prompt or task definition).
|
||||
2. **Partition by directory or module.** Prefer assigning entire directories/modules to one worker rather than splitting files within a directory across workers.
|
||||
3. **Shared files are serialized.** If two tasks must modify the same file (e.g., a shared types file, a barrel export), they MUST run sequentially — never in parallel. Mark the second task with `depends_on` pointing to the first.
|
||||
4. **Test files follow source ownership.** If Worker A owns `src/auth/login.ts`, Worker A also owns `src/auth/__tests__/login.test.ts`. Do not split source and test across workers.
|
||||
5. **Config files are orchestrator-reserved.** Files like `package.json`, `tsconfig.json`, and CI config are owned by the orchestrator and modified only between worker cycles, never during parallel execution.
|
||||
6. **Document ownership in dispatch.** When spawning a worker, include an explicit `Files:` section listing owned paths/globs. Example:
|
||||
|
||||
```
|
||||
Files (exclusive — do not touch files outside this scope):
|
||||
- apps/web/src/components/auth/**
|
||||
- apps/web/src/lib/auth.ts
|
||||
```
|
||||
|
||||
7. **Conflict recovery.** If a worker edits a file outside its scope, the orchestrator MUST flag the violation, assess the diff, and either revert the out-of-scope change or re-run the affected worker with the corrected file.
|
||||
|
||||
## Delegation Mode Selection
|
||||
|
||||
Choose one delegation mode at session start:
|
||||
|
||||
Reference in New Issue
Block a user