ワンクリックで
architecture
Use when a file or module is too large, responsibilities are tangled, or a cross-cutting redesign is needed
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
メニュー
Use when a file or module is too large, responsibilities are tangled, or a cross-cutting redesign is needed
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
SOC 職業分類に基づく
Use when literature notes exist and need citation verification, or before publishing any artifact that cites literature
Use at the end of a work session to embed learnings into conventions. Simplified for models with lower reasoning capacity.
Use at the end of a work session, or when accumulated findings need to be embedded into conventions, skills, or patterns
Use when the Slack bot needs to handle an operational action like launching an experiment, querying status, or processing approvals
Use when a plan, finding, or design needs adversarial review before committing to it
Use when designing a new experiment or research protocol and need to ensure methodological rigor
| name | architecture |
| description | Use when a file or module is too large, responsibilities are tangled, or a cross-cutting redesign is needed |
| complexity | high |
| model-minimum | gpt-5 |
| disable-model-invocation | false |
| allowed-tools | ["Read","Grep","Glob","Edit","Write","Bash(cd * && npx tsc --noEmit)","Bash(wc -l *)","Bash(wc *)","Bash(git diff *)","Bash(git log *)"] |
| argument-hint | [file, module, 'scan', 'map', 'auto', or redesign description] |
Analyze and evolve the akari infrastructure — from targeted refactoring of a single file to cross-cutting architectural redesign. This skill operates at four levels:
The argument determines the mode:
| Argument | Mode | Example |
|---|---|---|
auto or empty | Autonomous diagnosis | /architecture auto or /architecture |
| File path or module name | Refactor | /architecture chat.ts |
scan | Refactor scan | /architecture scan |
map or map <subsystem> | Architectural map | /architecture map agents |
| Anything else | Redesign | /architecture unify chat and autofix agents |
/simplify: simplify removes; architecture restructures./gravity: gravity adds capabilities; architecture reorganizes existing ones./design: design is for experiment methodology; architecture is for infrastructure code.When invoked without specific instructions (/architecture or /architecture auto), autonomously diagnose the infrastructure's architectural health and implement improvements following the hierarchy: safety > clarity > efficiency.
Survey the entire infra/ directory structure for issues across five dimensions:
Grep for common function signatures, error patterns, config handling)tsc --noEmit or have any types where specific types belongFor each issue found:
Verify compliance against architectural constraints (Section "Architectural constraints" below):
infra/ (not in projects/)decisions/*.mdtsc --noEmit passes)Flag any violations as critical severity.
Rank all discovered issues:
Priority 1 (SAFETY) — must fix, prevents correctness or data loss:
Priority 2 (CLARITY) — blocks understanding and modification:
Priority 3 (EFFICIENCY) — degrades performance or resource usage:
Within each priority tier, prefer: lower effort × larger impact radius.
For the single highest-priority issue:
tsc --noEmit if touching TypeScript, check that no imports brokeImplementation constraint: Only implement ONE fix per /architecture auto invocation. This prevents cascading changes and keeps each improvement reviewable.
Write the full issues report to projects/akari/diagnosis/architecture-scan-YYYY-MM-DD.md (using today's date). This ensures discovered issues persist across sessions — the report in session output is ephemeral and lost when the session ends.
After saving the report, convert unfixed issues to tasks:
[fleet-eligible] [skill: execute] for code fixes, [requires-opus] for redesignsDone when: derived from the issue description and verification criteriaWhy: referencing the architecture scan report file pathThis ensures architecture issues persist as actionable tasks rather than only as report entries that require future /architecture auto invocations to rediscover.
Even if you implement a fix, report ALL discovered issues prioritized, so the next session knows what remains.
## Architecture Auto-Diagnosis — YYYY-MM-DD
Files: <N> | Issues: <N>
### Issues (safety > clarity > efficiency)
- [<SEVERITY>] <issue> | Files: <affected> | Effort: <estimate>
### Constraints: <pass/fail status>
### Fix: <issue + files changed + verification>
### Next: <highest-priority remaining, or "Architecture health: good">
Stop: No Priority 1/2 issues → report "Architecture health: good" and make no changes.
Before changing anything, internalize these:
infra/. Projects contain research artifacts, not code.decisions/ are binding. Read decisions relevant to the code you're touching. Do not contradict them. If a decision is wrong, note it but do not override.cd infra/scheduler && npx tsc --noEmit.backend.ts provides a unified interface over Claude SDK and Cursor CLI. Do not break the backend-agnostic contract.security.ts validates all external input. Validation must happen before execution, never after.Produce a complete architectural map of the system or a subsystem. Read-only — no changes.
infra/scheduler/src/).agent.ts, chat.ts, event-agents.ts, executor.ts). For each:
allowedTools array is passedmaxTurns limitpermissionMode and allowDangerouslySkipPermissions## Architectural map: <scope> — YYYY-MM-DD
### Agents (spawn, prompt, tools, model, maxTurns, permissions, lifecycle, communication, unique capability)
### Dependencies: <module graph>
### Data flow: <persistent vs ephemeral vs hybrid>
### Governance: <budget, approval, security, verification layers>
### Observations: <strengths, weaknesses, opportunities>
Propose and implement architectural changes that alter behavior, introduce new patterns, or change how components interact. This goes beyond refactoring — it may change what agents exist, what they can do, and how they communicate.
Run the Map procedure (above) for the affected subsystem. You need a complete picture before proposing changes.
Use EnterPlanMode, write map findings + design tension + proposal + draft ADR, then ExitPlanMode for user approval before implementing.
What's wrong with the current architecture? Frame as a tension between two or more forces:
Name the tension explicitly. Vague "this should be better" is not a design tension.
For each proposed change:
Present the full proposal and wait for user approval before implementing. Redesigns are not auto-approved — they introduce new patterns that may have non-obvious consequences.
Break the redesign into atomic steps. Each step must:
cd infra/scheduler && npx tsc --noEmitOrder of operations for a typical redesign:
Write decisions/NNNN-<title>.md with context, decision, consequences. ADR task bridge: If ADR has unimplemented Migration steps, create corresponding tasks. Convention propagation: If redesign modified a cross-file convention, propagate to all locations.
## Redesign: <title> — YYYY-MM-DD
### Current state: <map findings>
### Design tension: <name + why current falls wrong side>
### Proposal: <changes with what/why/breaks/migration/verification>
### Migration: <steps>
### ADR: <draft decisions/NNNN-title.md>
For scan or a specific file/module target. Pure structural improvement — no behavioral changes.
Survey all infra source code for refactoring candidates:
.ts file in infra/scheduler/src/ and note line counts.## Refactoring scan — YYYY-MM-DD
### Candidates: <file | lines | issue | risk | effort | sketch>
### Dependencies: <module map>
### Recommendation: <next action>
Stop after scan — do not implement unless asked.
decisions/ for constraints on this module.## Refactoring: <what> — YYYY-MM-DD
### Changes: <file: what/why>
### New modules: <file: purpose>
### Behavioral: None
### Verification: tsc pass, <N> files changed
Follow docs/sops/commit-workflow.md. Commit message: architecture: <mode> — <brief summary of changes>
EnterPlanMode, exit with ExitPlanMode for user approval.decisions/ before contradicting any established pattern.