|
1 | | -# Project Memory: AgentSys |
| 1 | +# agentsys |
2 | 2 |
|
3 | | -> **Cross-tool compatible**: This file works as CLAUDE.md (Claude Code) and can be copied to AGENTS.md for OpenCode, Codex, and other AI tools. |
| 3 | +> A modular runtime and orchestration system for AI agents - works with Claude Code, OpenCode, and Codex CLI |
4 | 4 |
|
5 | | -<project-memory> |
| 5 | +## Critical Rules |
6 | 6 |
|
7 | | -<critical-rules> |
8 | | -## Critical Rules (Priority Order) |
9 | | - |
10 | | -1. **Production project** - Real users depend on this. Test thoroughly and verify all edge cases before committing. |
11 | | - *WHY: Breaking changes affect all plugin users immediately.* |
12 | | - |
13 | | -2. **Plugin for OTHER projects** - Optimize for plugin users, not internal dev convenience. |
14 | | - *WHY: Every decision must improve the experience for developers using this in their repos.* |
15 | | - |
16 | | -3. **Use CHANGELOG.md for completion tracking** - MUST use CHANGELOG.md for release notes. NEVER create `*_AUDIT.md`, `*_SUMMARY.md`, `*_COMPLETION.md` files. |
17 | | - *WHY: Summary files clutter repos and add no value. Report completion verbally.* |
18 | | - |
19 | | -4. **Unless** it is a very small change of max few lines, or an urgent hotfix, **MUST create PRs for all changes** - No direct pushes to main. |
20 | | - *WHY: PRs enable reviews, CI checks, and rollback if needed. Direct pushes are risky.* |
21 | | - |
22 | | -5. **PR reviews** - Wait 3 min for auto-reviewers, address ALL comments (Copilot, Claude, Gemini, Codex). |
23 | | - *WHY: Skipping comments leads to merged issues. Every comment must be addressed or explained.* |
24 | | - |
25 | | -6. **Read checklists BEFORE multi-file changes** - **MUST** read the relevant checklist before starting: |
26 | | - - **Cross-platform work → `checklists/cross-platform-compatibility.md`** (MASTER REF) |
27 | | - - Release → `checklists/release.md` |
28 | | - - New command → `checklists/new-command.md` |
29 | | - - New agent → `checklists/new-agent.md` |
30 | | - - New skill → `checklists/new-skill.md` |
31 | | - - New lib module → `checklists/new-lib-module.md` |
32 | | - - OpenCode plugin update → `checklists/update-opencode-plugin.md` |
33 | | - - Repo map changes → `checklists/repo-map.md` |
34 | | - *WHY: Multi-file changes have hidden dependencies. Checklists prevent missed updates.* |
35 | | - |
36 | | -7. **Especially Before release, and when delivering ANY work** - Check the relevant checklist for completion requirements: |
37 | | - - Identify which checklist applies to your work (see rule #6) |
38 | | - - Go through EVERY item in that checklist and apply it (e.g. run commands, which files to bump versions in, etc) |
39 | | - - Run the `/enhance` command on new or modified commands, agents, skills, hooks or prompts |
40 | | - - Verify cross-platform compatibility (OpenCode + Codex) |
41 | | - - Update `bin/cli.js` mappings if new command/agent added |
42 | | - - Only mark complete after ALL checklist items are done |
43 | | - *WHY: Checklists exist because we kept missing things. They are the definition of "done".* |
44 | | - |
45 | | -8. **Use plain text markers** - MUST use `[OK]`, `[ERROR]`, `[WARN]`, `[CRITICAL]` for status. NEVER use emojis or ASCII art boxes. |
46 | | - - Save tokens - conciseness and clarity over decorations |
47 | | - - Use markdown formatting instead of decorative borders |
48 | | - *WHY: Emojis and ASCII art waste tokens. AI models parse plain text better.* |
49 | | - |
50 | | -9. **gh/git on Windows** - Escape `$` as `\$` in GraphQL queries, avoid `!=` in jq (use `== "A" or == "B"`). |
51 | | - - `gh pr checks` uses `state` not `conclusion` - returns UPPERCASE: `SUCCESS`, `FAILURE`, `PENDING` |
52 | | - - Single quotes unreliable - use double quotes with escaped inner quotes |
53 | | - *WHY: Windows shell interprets $ and ! differently. These cause silent failures.* |
54 | | - |
55 | | -10. **Always run git hooks** - Run all pre-commit and pre-push hooks. If a hook blocks, fix the reported issue. |
56 | | - - Hooks catch problems before they reach the repo |
57 | | - - Fix the root cause, then retry |
58 | | - *WHY: Hooks are safety nets. Bypassing them defeats their purpose.* |
59 | | - |
60 | | -11. **Argument hints use `[]` not `<>`** - In `argument-hint` frontmatter, use `[arg]` for optional args, not `<arg>`. |
61 | | - - Correct: `argument-hint: "[path] [--fix] [--target [target]]"` |
62 | | - - Wrong: `argument-hint: "[path] [--fix] [--target <target>]"` |
63 | | - *WHY: Consistent with Claude Code conventions. Angle brackets are ambiguous.* |
64 | | - |
65 | | -12. **Fix all test failures** - NEVER skip or ignore a failing test because it's "out of scope" or "pre-existing". Always fix it. |
66 | | - - If a test fails during your work, fix it before proceeding |
67 | | - - No test is someone else's problem |
68 | | - *WHY: Skipping failures erodes test trust. Every green run must mean everything works.* |
69 | | - |
70 | | -13. **Report script failures before manual fallback** - When any project script fails (npm test/run/build, scripts/*, agentsys-dev, node bin/dev-cli.js), you MUST: |
| 7 | +1. **Plain text output** - No emojis, no ASCII art. Use `[OK]`, `[ERROR]`, `[WARN]`, `[CRITICAL]` for status markers. |
| 8 | +2. **No unnecessary files** - Don't create summary files, plan files, audit files, or temp docs. |
| 9 | +3. **Task is not done until tests pass** - Every feature/fix must have quality tests. |
| 10 | +4. **Create PRs for non-trivial changes** - No direct pushes to main. |
| 11 | +5. **Always run git hooks** - Never bypass pre-commit or pre-push hooks. |
| 12 | +6. **Use single dash for em-dashes** - In prose, use ` - ` (single dash with spaces), never ` -- `. |
| 13 | +7. **Report script failures before manual fallback** - When any project script fails (npm test/run/build, scripts/*, agentsys-dev, node bin/dev-cli.js), you MUST: |
71 | 14 | - Report the failure with exact error output to the user |
72 | 15 | - Diagnose the root cause of the failure |
73 | 16 | - Fix the script/tooling issue, not work around it manually |
74 | 17 | - NEVER silently fall back to doing the work by hand |
75 | | - *WHY: Silent fallbacks mask broken tooling. A failed script needs fixing, not bypassing.* |
76 | | -</critical-rules> |
77 | | - |
78 | | -<architecture> |
79 | | -## Architecture |
| 18 | +8. **Token efficiency** - Be concise. Save tokens over decorations. |
80 | 19 |
|
81 | | -<!-- GEN:START:claude-architecture --> |
82 | | -``` |
83 | | -lib/ → Shared library (vendored to plugins) |
84 | | -plugins/ → 0 plugins, 10 agents (0 file-based + 10 role-based), 0 skills |
85 | | -adapters/ → Platform adapters (opencode-plugin/, opencode/, codex/) |
86 | | -checklists/ → Action checklists (9 files) |
87 | | -bin/cli.js → npm CLI installer |
88 | | -``` |
| 20 | +## Model Selection |
89 | 21 |
|
90 | | -| Plugin | Agents | Skills | Purpose | |
91 | | -|--------|--------|--------|---------| |
92 | | -<!-- GEN:END:claude-architecture --> |
| 22 | +| Model | When to Use | |
| 23 | +|-------|-------------| |
| 24 | +| **Opus** | Complex reasoning, analysis, planning | |
| 25 | +| **Sonnet** | Validation, pattern matching, most agents | |
| 26 | +| **Haiku** | Mechanical execution, no judgment needed | |
93 | 27 |
|
94 | | -> Note: `plugins/ → 0 plugins` is correct — all 14 plugins now live in standalone repos under |
95 | | -> the [agent-sh](https://github.com/agent-sh) org. The ecosystem-wide counts (14 plugins, |
96 | | -> 43 agents, 30 skills) reflect all repos combined. agentsys is the marketplace and installer. |
| 28 | +## Core Priorities |
97 | 29 |
|
98 | | -**Pattern**: `Command → Agent → Skill` (orchestration → invocation → implementation) |
99 | | -</architecture> |
| 30 | +1. User DX (plugin users first) |
| 31 | +2. Worry-free automation |
| 32 | +3. Token efficiency |
| 33 | +4. Quality output |
| 34 | +5. Simplicity |
100 | 35 |
|
101 | | -<commands> |
102 | 36 | ## Commands |
103 | 37 |
|
104 | | -### Core Workflow |
105 | | -- `/next-task` - Master workflow: task → implementation → PR → merge |
| 38 | +- `/next-task` - Task workflow: discovery, implementation, PR, merge |
106 | 39 | - `/ship` - PR creation, CI monitoring, merge |
107 | | -- `/enhance` - Run all enhancement analyzers |
108 | | - |
109 | | -### Analysis |
| 40 | +- `/enhance` - Run enhancement analyzers |
110 | 41 | - `/audit-project` - Multi-agent code review |
111 | 42 | - `/deslop` - Clean AI slop patterns |
112 | 43 | - `/drift-detect` - Compare plan vs implementation |
113 | 44 | - `/perf` - Performance investigation |
114 | 45 | - `/repo-map` - Generate AST-based repo map |
115 | | - |
116 | | -### Learning |
117 | | -- `/learn` - Research topic online, create learning guide with RAG index |
118 | | - |
119 | | -### Linting |
120 | | -- `/agnix` - Lint agent configs (SKILL.md, CLAUDE.md, hooks, MCP) |
121 | | - |
122 | | -### Maintenance |
123 | 46 | - `/sync-docs` - Update documentation to match code |
124 | 47 |
|
125 | | -### Dev Commands |
126 | | -```bash |
127 | | -# Local dev CLI (when developing agentsys itself) |
128 | | -npx agentsys-dev status # Project health (version, counts, branch) |
129 | | -npx agentsys-dev validate # Run all validators |
130 | | -npx agentsys-dev validate plugins # Run single validator |
131 | | -npx agentsys-dev bump <version> # Bump all version files (e.g., 3.7.3) |
132 | | -npx agentsys-dev test # Run test suite |
133 | | -npx agentsys-dev preflight # Change-aware checklist enforcement |
134 | | -npx agentsys-dev preflight --all # Run all checks |
135 | | -npx agentsys-dev preflight --release # All checks + release extras |
136 | | -npx agentsys-dev gen-docs # Auto-generate doc sections |
137 | | -npx agentsys-dev gen-docs --check # Validate docs are fresh (CI) |
138 | | -npx agentsys-dev expand-templates # Expand template markers in agents |
139 | | -npx agentsys-dev expand-templates --check # Validate templates are fresh (CI) |
140 | | -npx agentsys-dev new plugin <name> # Scaffold new plugin |
141 | | -npx agentsys-dev new agent <name> --plugin=<plugin> # Scaffold new agent |
142 | | -npx agentsys-dev new skill <name> --plugin=<plugin> # Scaffold new skill |
143 | | -npx agentsys-dev new command <name> --plugin=<plugin> # Scaffold new command |
144 | | -npx agentsys-dev --help # Show all commands |
145 | | - |
146 | | -# Alternative: direct invocation |
147 | | -node bin/dev-cli.js <command> |
| 48 | +## Dev Commands |
148 | 49 |
|
149 | | -# npm aliases still work: |
150 | | -npm test # Run tests (do before commits) |
151 | | -npm run validate # All validators via dev-cli |
152 | | -npm run preflight # Change-aware preflight checks |
153 | | -npm run preflight:all # All preflight checks |
154 | | -npm run preflight:release # Release preflight |
155 | | -npm run gen-docs # Auto-generate documentation |
156 | | -npm run gen-docs:check # Check if docs are stale |
157 | | -npm run expand-templates # Expand agent templates |
158 | | -npm run expand-templates:check # Check if templates are stale |
159 | | -npm run new:plugin # Scaffold new plugin |
160 | | -npm run new:agent # Scaffold new agent |
161 | | -npm run new:skill # Scaffold new skill |
162 | | -npm run new:command # Scaffold new command |
163 | | -npm run bump <version> # Bump versions via dev-cli |
164 | | -npm pack # Build package |
165 | | -agentsys # Run installer |
| 50 | +```bash |
| 51 | +npm test # Run tests |
| 52 | +npm run validate # All validators |
166 | 53 | ``` |
167 | | -</commands> |
168 | | - |
169 | | -<agents> |
170 | | -## Agents |
171 | | - |
172 | | -40 agents across 11 plugins. Key agents by model: |
173 | | - |
174 | | -| Model | Agents | Use Case | |
175 | | -|-------|--------|----------| |
176 | | -| **opus** | planning, implementation, perf-orchestrator, debate-orchestrator | Complex reasoning, judgment | |
177 | | -| **sonnet** | exploration, learn, task-discoverer, delivery-validator, ci-fixer, deslop-agent, reporters | Validation, pattern matching | |
178 | | -| **haiku** | worktree-manager, ci-monitor, simple-fixer | Mechanical execution | |
179 | | - |
180 | | -See [README.md](./README.md#command-details) and [docs/reference/AGENTS.md](./docs/reference/AGENTS.md) for full agent list. |
181 | | -</agents> |
182 | | - |
183 | | -<skills> |
184 | | -## Skills |
185 | | - |
186 | | -26 skills across plugins. Agents invoke skills for reusable implementation. |
187 | | - |
188 | | -| Category | Key Skills | |
189 | | -|----------|------------| |
190 | | -| Workflow | `orchestrate-review`, `discover-tasks`, `validate-delivery` | |
191 | | -| Enhancement | `enhance-*` (9 skills for plugins, agents, docs, prompts, hooks) | |
192 | | -| Performance | `baseline`, `benchmark`, `profile`, `theory-tester` | |
193 | | -| Cleanup | `deslop`, `sync-docs`, `drift-analysis`, `repo-mapping` | |
194 | | - |
195 | | -See [README.md](./README.md#skills) for full skill list. |
196 | | -</skills> |
197 | | - |
198 | | -<state-files> |
199 | | -## State Files |
200 | | - |
201 | | -| File | Location | Purpose | |
202 | | -|------|----------|---------| |
203 | | -| `tasks.json` | `{stateDir}/` | Active task registry | |
204 | | -| `flow.json` | `{stateDir}/` (worktree) | Workflow progress | |
205 | | -| `preference.json` | `{stateDir}/sources/` | Cached task source | |
206 | | -| `suppressions.json` | `~/.<claude\|opencode\|codex>/enhance/` | Auto-learned suppressions | |
207 | | - |
208 | | -Platform-aware state directory: |
209 | | -- Claude Code: `.claude/` |
210 | | -- OpenCode: `config/.opencode/` |
211 | | -- Codex: `.codex/` |
212 | | -</state-files> |
213 | | - |
214 | | -<workflow-agents> |
215 | | -## Workflow Agents (MUST-CALL) |
216 | | - |
217 | | -Cannot skip in /next-task: |
218 | | -- `exploration-agent` → before planning |
219 | | -- `planning-agent` → before implementation |
220 | | -- **Phase 9 review loop** → MUST use orchestrate-review skill |
221 | | -- `delivery-validator` → before sync-docs:sync-docs-agent |
222 | | -- `sync-docs:sync-docs-agent` → before /ship |
223 | | -</workflow-agents> |
224 | | - |
225 | | -<pr-auto-review> |
226 | | -## PR Auto-Review |
227 | | - |
228 | | -4 reviewers: Copilot, Claude, Gemini, Codex |
229 | | - |
230 | | -1. Wait 3 min after PR creation (initial auto-reviews) |
231 | | -2. Claude-review may take 10+ min - wait for it |
232 | | -3. Read ALL comments |
233 | | -4. Address EVERY comment |
234 | | -5. Iterate until zero unresolved |
235 | | -</pr-auto-review> |
236 | | - |
237 | | -<model-selection> |
238 | | -## Model Selection |
239 | | - |
240 | | -| Model | When to Use | |
241 | | -|-------|-------------| |
242 | | -| **Opus** | Complex reasoning, analysis where imperfection compounds | |
243 | | -| **Sonnet** | Validation, pattern matching, most agents | |
244 | | -| **Haiku** | Mechanical execution, no judgment needed | |
245 | | -</model-selection> |
246 | | - |
247 | | -<priorities> |
248 | | -## Core Priorities |
249 | | - |
250 | | -1. User DX (plugin users) |
251 | | -2. Worry-free automation |
252 | | -3. Token efficiency |
253 | | -4. Quality output |
254 | | -5. Simplicity |
255 | | -</priorities> |
256 | 54 |
|
257 | | -<end-reminder> |
258 | | -**REMEMBER**: |
259 | | -- Use CHANGELOG.md for completion tracking (not summary files) |
260 | | -- BEFORE starting → Read the relevant checklist (`checklists/*.md`) |
261 | | -- BEFORE delivering any work, especially releases → Go through that checklist item by item |
262 | | -- 3 platforms: Claude Code + OpenCode + Codex - ALL must work |
263 | | -- Agent/Skill pattern: Agents invoke skills, skills have implementation |
264 | | -- Create PRs for non-trivial changes |
265 | | -</end-reminder> |
| 55 | +## References |
266 | 56 |
|
267 | | -</project-memory> |
| 57 | +- Part of the [agentsys](https://github.com/agent-sh/agentsys) ecosystem |
| 58 | +- https://agentskills.io |
0 commit comments