Skip to content

Commit 0146f0e

Browse files
avifeneshagent-core-bot
andauthored
chore: sync core lib and CLAUDE.md from agent-core (#267)
* chore: sync core lib and CLAUDE.md from agent-core * fix: address review comments and failing tests - Expand CLAUDE.md rule #7 with detailed body text (fixes 3 test assertions) - Remove auto-generated comment from CLAUDE.md - Clean up dead requires/core code in bin/cli.js to match schema removal --------- Co-authored-by: agent-core-bot <noreply@agent-sh.github.io>
1 parent 8aee89b commit 0146f0e

File tree

4 files changed

+33
-300
lines changed

4 files changed

+33
-300
lines changed

CLAUDE.md

Lines changed: 32 additions & 241 deletions
Original file line numberDiff line numberDiff line change
@@ -1,267 +1,58 @@
1-
# Project Memory: AgentSys
1+
# agentsys
22

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
44
5-
<project-memory>
5+
## Critical Rules
66

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:
7114
- Report the failure with exact error output to the user
7215
- Diagnose the root cause of the failure
7316
- Fix the script/tooling issue, not work around it manually
7417
- 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.
8019

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
8921

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 |
9327

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
9729

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
10035

101-
<commands>
10236
## Commands
10337

104-
### Core Workflow
105-
- `/next-task` - Master workflow: task → implementation → PR → merge
38+
- `/next-task` - Task workflow: discovery, implementation, PR, merge
10639
- `/ship` - PR creation, CI monitoring, merge
107-
- `/enhance` - Run all enhancement analyzers
108-
109-
### Analysis
40+
- `/enhance` - Run enhancement analyzers
11041
- `/audit-project` - Multi-agent code review
11142
- `/deslop` - Clean AI slop patterns
11243
- `/drift-detect` - Compare plan vs implementation
11344
- `/perf` - Performance investigation
11445
- `/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
12346
- `/sync-docs` - Update documentation to match code
12447

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
14849

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
16653
```
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>
25654

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
26656

267-
</project-memory>
57+
- Part of the [agentsys](https://github.com/agent-sh/agentsys) ecosystem
58+
- https://agentskills.io

bin/cli.js

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -268,13 +268,6 @@ function resolvePluginDeps(names, marketplace) {
268268
}
269269
visiting.add(name);
270270

271-
const plugin = pluginMap[name];
272-
if (plugin && plugin.requires) {
273-
for (const dep of plugin.requires) {
274-
visit(dep);
275-
}
276-
}
277-
278271
visiting.delete(name);
279272
resolved.add(name);
280273
}
@@ -723,9 +716,7 @@ function satisfiesRange(ver, range) {
723716
}
724717

725718
function checkCoreCompat(pluginEntry) {
726-
if (pluginEntry.core && !satisfiesRange(VERSION, pluginEntry.core)) {
727-
console.error(`[WARN] ${pluginEntry.name} requires agentsys ${pluginEntry.core}, you have ${VERSION}`);
728-
}
719+
// Core version compat check removed - field deprecated in schema
729720
}
730721

731722
// --- Granular install helpers ---
@@ -1005,23 +996,13 @@ async function installPlugin(nameWithVersion, args) {
1005996
// --- remove subcommand ---
1006997

1007998
function removePlugin(name) {
1008-
const marketplace = loadMarketplace();
1009999
const installed = loadInstalledJson();
10101000

10111001
if (!installed.plugins[name]) {
10121002
console.error(`[ERROR] Plugin ${name} is not installed.`);
10131003
process.exit(1);
10141004
}
10151005

1016-
// Check if any other installed plugin depends on this one
1017-
for (const [otherName] of Object.entries(installed.plugins)) {
1018-
if (otherName === name) continue;
1019-
const entry = marketplace.plugins.find(p => p.name === otherName);
1020-
if (entry && entry.requires && entry.requires.includes(name)) {
1021-
console.error(`[WARN] ${otherName} depends on ${name}. It may not work correctly after removal.`);
1022-
}
1023-
}
1024-
10251006
const platforms = installed.plugins[name].platforms || [];
10261007

10271008
// Remove from cache

lib/discovery/index.js

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -297,30 +297,6 @@ function getPluginPrefixRegex(repoRoot) {
297297
return new RegExp(`(${escaped.join('|')})`, 'g');
298298
}
299299

300-
/**
301-
* Discover plugins from marketplace.json instead of scanning the filesystem.
302-
* Used in the post-extraction world where plugins/ no longer exists in agentsys.
303-
*
304-
* @param {string} [repoRoot] - Repository root path
305-
* @returns {Array<{name: string, source: string, version: string, requires: string[], core: string}>}
306-
*/
307-
function discoverPluginsFromMarketplace(repoRoot) {
308-
if (!repoRoot) {
309-
repoRoot = path.resolve(__dirname, '..', '..');
310-
}
311-
const marketplacePath = path.join(repoRoot, '.claude-plugin', 'marketplace.json');
312-
if (!fs.existsSync(marketplacePath)) return [];
313-
314-
const marketplace = JSON.parse(fs.readFileSync(marketplacePath, 'utf8'));
315-
return (marketplace.plugins || []).map(p => ({
316-
name: p.name,
317-
source: p.source,
318-
version: p.version,
319-
requires: p.requires || [],
320-
core: p.core || ''
321-
}));
322-
}
323-
324300
/**
325301
* Get all discovery results in a single call.
326302
*
@@ -365,7 +341,6 @@ module.exports = {
365341
parseFrontmatter,
366342
isValidPluginName,
367343
discoverPlugins,
368-
discoverPluginsFromMarketplace,
369344
discoverCommands,
370345
discoverAgents,
371346
discoverSkills,

0 commit comments

Comments
 (0)