103 Commits

Author SHA1 Message Date
Affaan Mustafa
bfc73866c9 Revert "feat: add orchestration workflows and harness skills"
This reverts commit cb43402d7d.
2026-03-12 09:26:12 -07:00
Affaan Mustafa
cb43402d7d feat: add orchestration workflows and harness skills 2026-03-12 08:53:52 -07:00
Affaan Mustafa
51eec12764 fix: stop pinning o4-mini in codex config 2026-03-12 07:59:50 -07:00
Affaan Mustafa
da4db99c94 fix: repair opencode config and project metadata 2026-03-11 01:52:10 -07:00
Affaan Mustafa
dba4c462c4 Merge pull request #301 from 0xrohitgarg/add-videodb-skills
Add VideoDB Skills to Individual Skills
2026-03-10 21:27:02 -07:00
Affaan Mustafa
192d2b63f2 docs: align videodb event directory handling 2026-03-10 21:23:25 -07:00
Affaan Mustafa
70449a1cd7 docs: tighten videodb listener guidance 2026-03-10 21:22:35 -07:00
Affaan Mustafa
82f9f58d28 Merge pull request #290 from nocodemf/add-evos-operational-skills
feat(skills): Add 8 operational domain skills (logistics, manufacturing, retail, energy)
2026-03-10 21:19:01 -07:00
Affaan Mustafa
16b33eecb1 Merge pull request #389 from affaan-m/codex/add-php-rules
feat: add php rule pack
2026-03-10 21:18:35 -07:00
Affaan Mustafa
db2bf16427 docs: resolve videodb review findings 2026-03-10 21:18:33 -07:00
Affaan Mustafa
47a5d4b459 docs: resolve remaining operational skill comments 2026-03-10 21:13:55 -07:00
Affaan Mustafa
062956311d Merge pull request #388 from affaan-m/codex/fix-383-custom-endpoint-docs
docs: clarify custom endpoint support
2026-03-10 21:13:31 -07:00
Affaan Mustafa
2581bebfd9 docs: resolve videodb follow-up review comments 2026-03-10 21:11:00 -07:00
Affaan Mustafa
ed366bddbb feat: add php rule pack 2026-03-10 21:10:26 -07:00
Affaan Mustafa
6c8f425ae2 docs: resolve operational skill review issues 2026-03-10 21:07:36 -07:00
Affaan Mustafa
e0f8f914ee docs: clarify custom endpoint support 2026-03-10 21:06:06 -07:00
Affaan Mustafa
b0c2e77bd8 docs: clarify videodb reference guides 2026-03-10 21:04:02 -07:00
Affaan Mustafa
b8ab34e362 docs: harden videodb skill examples 2026-03-10 21:03:32 -07:00
Affaan Mustafa
22816651c2 fix: normalize operational skill packaging 2026-03-10 20:59:05 -07:00
Affaan Mustafa
0326442969 Merge pull request #387 from affaan-m/codex/fix-386-observer-max-turns
fix: raise observer analysis turn budget
2026-03-10 20:57:38 -07:00
Affaan Mustafa
7433610105 docs: tighten kotlin support examples 2026-03-10 20:53:39 -07:00
ali
f6a470de63 fix: resolve semantic mismatch between UseCase naming and ViewModel usage 2026-03-10 20:53:39 -07:00
ali
ab693f7b8a fix: address remaining PR review comments for Kotlin/Android/KMP docs 2026-03-10 20:53:39 -07:00
ali
2d5dc62ad0 fix: rename GetItemsUseCase to GetItemUseCase for consistency 2026-03-10 20:53:39 -07:00
ali
8961f24821 fix: address PR review comments for Kotlin/Android/KMP docs 2026-03-10 20:53:39 -07:00
ali
f10d638bfa feat: add Kotlin, Android, and KMP rules, agent, skills, and command 2026-03-10 20:53:39 -07:00
Affaan Mustafa
16bc7436c5 fix: raise observer analysis turn budget 2026-03-10 20:52:53 -07:00
Affaan Mustafa
2b8eca3ae9 Merge pull request #370 from Nomadu27/feat/insaits-security-hook
feat: add InsAIts PostToolUse security monitoring hook
2026-03-10 20:51:09 -07:00
Affaan Mustafa
5a5d647825 Merge origin/main into feat/insaits-security-hook 2026-03-10 20:48:59 -07:00
Affaan Mustafa
9c1e8dd1e4 fix: make insaits hook opt-in 2026-03-10 20:47:09 -07:00
Affaan Mustafa
034835073c Merge pull request #359 from pythonstrup/feat/optimize-biome-hooks
perf(hooks): optimize formatter hooks(x52 faster) — local binary, merged invocations, direct require()
2026-03-10 20:43:09 -07:00
Affaan Mustafa
78a56174b1 docs: tighten perl support guidance 2026-03-10 20:42:54 -07:00
Necip Sunmaz
36bcf20588 fix: address code review findings from cubic-dev-ai
- Fix path traversal regex prefix confusion in perl-security skill
  - Revert v1.4.0 changelog entry (Perl not part of that release)
  - Rename $a/$b to $x/$y to avoid shadowing sort globals
  - Replace return undef with bare return per perlcritic rules
2026-03-10 20:42:54 -07:00
Necip Sunmaz
b2a7bae5db feat: add Perl skills (patterns, security, testing) 2026-03-10 20:42:54 -07:00
Necip Sunmaz
ae5c9243c9 feat: add Perl language rules and update documentation
Add rules/perl/ with 5 rule files (coding-style, testing, patterns,
  hooks, security) following the same structure as existing languages.
  Update README.md, README.zh-CN.md, and rules/README.md to document
  Perl support including badges, directory trees, install instructions,
  and rule counts.
2026-03-10 20:42:54 -07:00
Affaan Mustafa
d239d873d8 Merge remote-tracking branch 'origin/main' into feat/optimize-biome-hooks
# Conflicts:
#	tests/hooks/hooks.test.js
#	tests/run-all.js
2026-03-10 20:25:22 -07:00
Affaan Mustafa
8f87a5408f docs: align session commands with session manager 2026-03-10 20:24:15 -07:00
avesh-h
b365ce861a docs: update session file path in save-session command documentation
Revised the documentation for the `/save-session` command to reflect the actual resolved path to the session file, enhancing clarity for users regarding where their session data is stored. This change aligns with previous updates to session file management.
2026-03-10 20:24:15 -07:00
avesh-h
b39e25a58f docs: update session file paths in save-session and resume-session commands
Revised the documentation for both the  and  commands to clarify that session files are saved and loaded from the project-level  directory, rather than the global  directory. This change enhances user understanding of session management and ensures consistency in file path references.
2026-03-10 20:24:15 -07:00
avesh-h
81022fdcfe docs: clarify session file paths and usage in resume-session command
Updated the documentation for the `/resume-session` command to specify that session files are loaded from the project-level `.claude/sessions/` directory first, with a fallback to the global `~/.claude/sessions/` directory. Enhanced usage examples and clarified the process for locating session files, improving user understanding of session management.
2026-03-10 20:24:15 -07:00
avesh-devx
e71024c4bd docs: enhance session file naming guidelines in save-session command
Updated the documentation for the `/save-session` command to include detailed rules for generating the session short-id, including allowed characters, minimum length, and examples of valid and invalid formats. This improves clarity and helps users adhere to the required naming conventions.
2026-03-10 20:24:15 -07:00
avesh-devx
043b3cd9a9 fix: update session file paths to use the home directory
Updated the documentation for the `/resume-session` and `/save-session` commands to reflect the correct file paths, changing references from `.claude/sessions/` to `~/.claude/sessions/`. This ensures clarity on the global directory used for session management and maintains consistency across commands.
2026-03-10 20:24:15 -07:00
avesh-devx
6937491d2a feat: add resume and save session commands for session management
Introduced two new commands: `/resume-session` and `/save-session`. The `/resume-session` command allows users to load the most recent session file or a specific session file, providing a structured briefing of the session's context. The `/save-session` command captures the current session state, saving it to a dated file for future reference. Both commands enhance user experience by enabling seamless session continuity and context preservation.
2026-03-10 20:24:15 -07:00
Affaan Mustafa
0c2954565d docs: add skill-stocktake agent invocation example 2026-03-10 20:15:38 -07:00
Tatsuya Shimomoto
02d754ba67 fix: use general-purpose agent instead of Explore for skill-stocktake evaluation
The Explore agent is a "Fast agent" optimized for codebase exploration,
not deep reasoning. The skill-stocktake V4 design requires holistic AI
judgment (actionability, scope fit, uniqueness, currency) which needs
the full reasoning capability of the conversation's main model.

Additionally, the Agent tool has no `model` parameter — specifying
`model: opus` was silently ignored, causing the evaluation to run on
the lightweight Explore model. This resulted in all skills receiving
"Keep" verdicts without genuine critical analysis.

Changing to `general-purpose` agent ensures evaluation runs on the
conversation's main model (e.g., Opus 4.6), enabling the holistic
judgment that V4 was designed for.
2026-03-10 20:15:38 -07:00
Affaan Mustafa
973be02aa6 docs: clarify learn-eval verdict flow 2026-03-10 20:14:19 -07:00
Tatsuya Shimomoto
5929db9b23 fix: resolve markdownlint MD001 heading level violation
Change h4 (####) to h3 (###) for sub-steps 5a and 5b to comply with
heading increment rule (headings must increment by one level at a time).
2026-03-10 20:14:19 -07:00
Tatsuya Shimomoto
32e11b8701 feat(commands): improve learn-eval with checklist-based holistic verdict
Replace the 5-dimension numeric scoring rubric with a checklist + holistic
verdict system (Save / Improve then Save / Absorb into [X] / Drop).

Key improvements:
- Explicit pre-save checklist: grep skills/ for duplicates, check MEMORY.md,
  consider appending to existing skills, confirm reusability
- 4-way verdict instead of binary save/don't-save: adds "Absorb into [X]"
  to prevent skill file proliferation, and "Improve then Save" for iterative
  refinement
- Verdict-specific confirmation flows tailored to each outcome
- Design rationale explaining why holistic judgment outperforms numeric
  scoring with modern frontier models
2026-03-10 20:14:19 -07:00
Affaan Mustafa
4fa817cd7d ci: install validation deps for hook checks 2026-03-10 20:14:18 -07:00
Affaan Mustafa
b0a6847007 docs: align TypeScript error handling examples 2026-03-10 19:38:31 -07:00
Jason Davey
327c2e97d8 feat: enhance TypeScript coding style guidelines with detailed examples and best practices esp interfaces and types 2026-03-10 19:38:31 -07:00
Affaan Mustafa
7705051910 fix: align architecture tooling with current hooks docs 2026-03-10 19:36:57 -07:00
kinshukdutta
a50349181a feat: architecture improvements — test discovery, hooks schema, catalog, command map, coverage, cross-harness docs
- AGENTS.md: sync skills count to 65+
- tests/run-all.js: glob-based test discovery for *.test.js
- scripts/ci/validate-hooks.js: validate hooks.json with ajv + schemas/hooks.schema.json
- schemas/hooks.schema.json: hookItem.type enum command|notification
- scripts/ci/catalog.js: catalog agents, commands, skills (--json | --md)
- docs/COMMAND-AGENT-MAP.md: command → agent/skill map
- docs/ARCHITECTURE-IMPROVEMENTS.md: improvement recommendations
- package.json: ajv, c8 devDeps; npm run coverage
- CONTRIBUTING.md: Cross-Harness and Translations section
- .gitignore: coverage/

Made-with: Cursor
2026-03-10 19:36:57 -07:00
Affaan Mustafa
c883289abb fix: curate everything-claude-code skill output 2026-03-10 19:36:37 -07:00
ecc-tools[bot]
65cb240e88 feat: add everything-claude-code skill (#335)
* feat: add everything-claude-code skill generated by ECC Tools

* feat: add everything-claude-code instincts for continuous learning

---------

Co-authored-by: ecc-tools[bot] <257055122+ecc-tools[bot]@users.noreply.github.com>
2026-03-10 19:36:37 -07:00
Affaan Mustafa
77f38955b3 fix: refresh codex config and docs 2026-03-10 19:31:25 -07:00
Affaan Mustafa
7c82aebc76 docs: tighten blueprint install guidance 2026-03-10 19:23:00 -07:00
Affaan Mustafa
205fa72809 docs: align blueprint skill with ECC install flow 2026-03-10 19:23:00 -07:00
ant
13fe21c5b7 fix: add git fetch and use pinned checkout for update flow
Address review feedback:
- Add missing `git fetch origin` before comparing commits
- Replace `git pull` with `git checkout <sha>` for deterministic updates
2026-03-10 19:23:00 -07:00
ant
f809bdd049 fix(skills): address review feedback on blueprint skill
- Pin installation to specific commit hash (full SHA) to mitigate
  supply-chain risk (cubic-dev-ai feedback)
- Add "When to Use", "How It Works", "Examples" sections to match
  repo skill format conventions (coderabbitai feedback)
- Add review-before-update instructions for safe version upgrades
- Emphasize zero-runtime-risk: pure Markdown, no executable code
2026-03-10 19:23:00 -07:00
ant
678ee7dc32 feat(skills): add blueprint skill for multi-session construction planning 2026-03-10 19:23:00 -07:00
Affaan Mustafa
5644415767 docs: tighten troubleshooting safety guidance 2026-03-10 19:15:12 -07:00
Pangerkumzuk Longkumer
b7bafb40cb docs: add comprehensive troubleshooting guide (fixes #326)
Added a comprehensive troubleshooting guide for the Everything Claude Code (ECC) plugin, covering common issues, symptoms, causes, and solutions.
2026-03-10 19:15:12 -07:00
Affaan Mustafa
4de776341e fix: handle null tool_response fallback 2026-03-10 19:14:56 -07:00
ispaydeu
708c265b4f fix: read tool_response field in observe.sh (#377)
Claude Code sends tool output as `tool_response` in PostToolUse hook
payloads, but observe.sh only checked for `tool_output` and `output`.
This caused all observations to have empty output fields, making the
observer pipeline blind to tool results.

Adds `tool_response` as the primary field to check, with backward-
compatible fallback to the existing `tool_output` and `output` fields.
2026-03-10 19:14:56 -07:00
Jonghyeok Park
67841042d6 refactor: deduplicate config lists and unify resolveFormatterBin branches
Extract BIOME_CONFIGS and PRETTIER_CONFIGS as shared constants to eliminate
duplication between PROJECT_ROOT_MARKERS and detectFormatter(). Unify the
biome/prettier branches in resolveFormatterBin() via a FORMATTER_PACKAGES
map. Remove redundant path.resolve() in quality-gate.js.
2026-03-11 10:45:28 +09:00
Jonghyeok Park
0a3afbe38f fix(hooks): add Windows .cmd support with shell injection guard
Handle Windows .cmd shim resolution via spawnSync with strict path
validation. Removes shell:true injection risk, uses strict equality,
and restores .cmd support with path injection guard.
2026-03-11 10:45:28 +09:00
Jonghyeok Park
66498ae9ac perf(hooks): use direct require() instead of spawning child process
Invoke hook scripts directly via require() when they export a
run(rawInput) function, eliminating one Node.js process spawn per
hook invocation (~50-100ms).

Includes path traversal guard, timeouts, error logging, PR review
feedback, legacy hooks guard, normalized filePath, and restored
findProjectRoot config detection with package manager support.
2026-03-11 10:45:27 +09:00
Nomadu27
9ea415c037 fix: extract BLOCKING_SEVERITIES constant, document broad catch
- Extract BLOCKING_SEVERITIES frozenset for extensible severity checks.
- Add inline comment on broad Exception catch explaining intentional
  SDK fault-tolerance pattern (BLE001 acknowledged).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-10 19:06:56 +01:00
Nomadu27
e30109829b fix: dict anomaly access, configurable fail mode, exception type logging
- Add get_anomaly_attr() helper that handles both dict and object
  anomalies. The SDK's send_message() returns dicts, so getattr()
  was silently returning defaults -- critical blocking never triggered.
- Fix field name: "detail" -> "details" (matches SDK schema).
- Make fail-open/fail-closed configurable via INSAITS_FAIL_MODE env var
  (defaults to "open" for backward compatibility).
- Include exception type name in fail-open log for diagnostics.
- Normalize severity comparison with .upper() for case-insensitive matching.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-10 18:53:21 +01:00
Nomadu27
68fc85ea49 fix: address cubic-dev-ai + coderabbit round 3 review
cubic-dev-ai P2: dev_mode now defaults to "false" (strict mode).
Users opt in to dev mode by setting INSAITS_DEV_MODE=true.

cubic-dev-ai P2: Move null-status check above stdout/stderr writes
in wrapper so partial/corrupt output is never leaked. Pass through
original raw input on signal kill, matching the result.error path.

coderabbit major: Wrap insAItsMonitor() and send_message() in
try/except so SDK errors don't crash the hook. Logs warning and
exits 0 (fail-open) on exception.

coderabbit nitpick: write_audit now creates a new dict (enriched)
instead of mutating the caller's event dict.

coderabbit nitpick: Extract magic numbers to named constants:
MIN_CONTENT_LENGTH=10, MAX_SCAN_LENGTH=4000, DEFAULT_MODEL.

Also: added env var documentation to module docstring.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-10 18:25:23 +01:00
Nomadu27
0405ade5f4 fix: make dev_mode configurable via INSAITS_DEV_MODE env var
Defaults to true (no API key needed) but can be disabled by setting
INSAITS_DEV_MODE=false for production deployments with an API key.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-10 18:09:02 +01:00
Nomadu27
6c56e541dd fix: address cubic-dev-ai review — 3 issues
P1: Log non-ENOENT spawn errors (timeout, signal kill) to stderr
instead of silently exiting 0. Separate handling for result.error
and null result.status so users know when the security monitor
failed to run.

P1: Remove "async": true from hooks.json — async hooks run in the
background and cannot block tool execution. The security hook needs
to be synchronous so exit(2) actually prevents credential exposure
and other critical findings from proceeding.

P2: Remove dead tool_response/tool_result code from extract_content.
In a PreToolUse hook the tool hasn't executed yet, so tool_response
is never populated. Removed the variable and the unreachable branch
that appended its content.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-10 18:08:19 +01:00
Nomadu27
44dc96d2c6 fix: address CodeRabbit review — convert to PreToolUse, add type annotations, logging
Critical fixes:
- Convert hook from PostToolUse to PreToolUse so exit(2) blocking works
- Change all python references to python3 for cross-platform compat
- Add insaits-security-wrapper.js to bridge run-with-flags.js to Python

Standard fixes:
- Wrap hook with run-with-flags.js so users can disable via
  ECC_DISABLED_HOOKS="pre:insaits-security"
- Add "async": true to hooks.json entry
- Add type annotations to all function signatures (Dict, List, Tuple, Any)
- Replace all print() statements with logging module (stderr)
- Fix silent OSError swallow in write_audit — now logs warning
- Remove os.environ.setdefault('INSAITS_DEV_MODE') — pass dev_mode=True
  through monitor constructor instead
- Update hooks/README.md: moved to PreToolUse table, "detects" not
  "catches", clarify blocking vs non-blocking behavior

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-10 17:52:44 +01:00
Jonghyeok Park
e5d02000c3 perf(hooks): eliminate npx overhead and merge biome invocations
- Use local node_modules/.bin/biome binary instead of npx (~200-500ms savings)
- Change post-edit-format from `biome format --write` to `biome check --write`
  (format + lint in one pass)
- Skip redundant biome check in quality-gate for JS/TS files already
  handled by post-edit-format
- Fix quality-gate to use findProjectRoot instead of process.cwd()
- Export run() function from both hooks for direct invocation
- Update tests to match shared resolve-formatter module usage
2026-03-10 22:19:31 +09:00
Jonghyeok Park
f331d3ecc9 feat(hooks): add shared resolve-formatter utility with caching
Extract project-root discovery, formatter detection, and binary
resolution into a reusable module. Caches results per-process to
avoid redundant filesystem lookups on every Edit hook invocation.

This is the foundation for eliminating npx overhead in format hooks.
2026-03-10 22:17:02 +09:00
Affaan Mustafa
af51fcacb7 fix: resolve PR 371 portability regressions 2026-03-09 22:49:43 -07:00
Affaan Mustafa
1c5e07ff77 test: fix windows path shims for formatter hooks 2026-03-09 22:49:43 -07:00
Affaan Mustafa
d66bd6439b docs: clarify opencode npm plugin scope 2026-03-09 22:49:43 -07:00
Affaan Mustafa
440178d697 fix: harden hook portability and plugin docs 2026-03-09 22:49:43 -07:00
Nomadu27
540f738cc7 feat: add InsAIts PostToolUse security monitoring hook
- Add insaits-security-monitor.py: real-time AI security monitoring
  hook that catches credential exposure, prompt injection,
  hallucinations, and 20+ other anomaly types
- Update hooks.json with InsAIts PostToolUse entry
- Update hooks/README.md with InsAIts in PostToolUse table
- Add InsAIts MCP server entry to mcp-configs/mcp-servers.json

InsAIts (https://github.com/Nomadu27/InsAIts) is an open-source
runtime security layer for multi-agent AI. It runs 100% locally
and writes tamper-evident audit logs to .insaits_audit_session.jsonl.

Install: pip install insa-its

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-10 01:02:58 +01:00
Affaan Mustafa
0f416b0b9d Update recommended models to GPT 5.4 2026-03-08 08:40:48 -07:00
Affaan Mustafa
6090401ccd fix: update hook integration tests for auto-tmux-dev behavior
PR #344 replaced the blocking dev-server hook with auto-tmux-dev.js
which transforms commands into tmux sessions (exit 0) instead of
blocking them (exit 2). Updated 2 tests to match the new behavior.
2026-03-07 22:45:44 -08:00
Affaan Mustafa
e3314f41e4 fix: remove internal sponsor/partner notes from public README
The "Traction & Distribution" section contained internal business
context (sponsor-call checklists, partner reporting instructions)
that doesn't belong in a user-facing README.
2026-03-07 20:26:24 -08:00
Affaan Mustafa
036d8e872c Revert "fix: remove internal sponsor/partner notes from public README"
This reverts commit 27ee3a449b.
2026-03-07 20:26:04 -08:00
Affaan Mustafa
27ee3a449b fix: remove internal sponsor/partner notes from public README
The "Traction & Distribution" section contained internal business
context (sponsor-call checklists, partner reporting instructions)
that doesn't belong in a user-facing README. Moved to docs/business/.
2026-03-07 20:19:37 -08:00
Frank
b994a076c2 docs: add guidance for project documentation capture (#355) 2026-03-07 14:48:11 -08:00
Pangerkumzuk Longkumer
e2d78d6def Add Contributor Covenant Code of Conduct (#330)
Added Contributor Covenant Code of Conduct to promote a harassment-free community.
2026-03-07 14:48:09 -08:00
Dang Nguyen
9b69dd0d03 feat(CLI): Add Antigravity IDE support via --target antigravity flag (#332)
* feat(CLI): Add Antigravity IDE support via `--target antigravity` flag

This Pull Request introduces `--target antigravity` support within the installation script to bridge Everything Claude Code configurations smoothly onto the Antigravity IDE ecosystem.

### Key Changes
- Modified `install.sh` to parse and act on the new `--target antigravity` CLI arg.
- **Flattened Rules Conversion**: Logic automatically copies Language-agnostic (Common/Globs) rules as well as specific language stack rules into `common-*.md` and `{lang}-*.md` structures within `.agent/rules/`.
- **Workflow & Agent Aggregation**: Commands safely fall in `.agent/workflows/`, and `agents/` alongside `skills/` components are merged into `.agent/skills/`.
- Contains overwrite warnings to ensure local customized rules aren't completely overridden without consent.
- Minor updates to `README.md` to properly document the flag addition.

* Update install.sh

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

---------

Co-authored-by: dangnd1 <dangnd1@vnpay.vn>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
2026-03-07 14:48:07 -08:00
zdoc.app
abcf38b085 docs(zh-CN): sync Chinese docs with latest upstream changes (#341)
* docs(zh-CN): sync Chinese docs with latest upstream changes

* docs(zh-CN): update link

---------

Co-authored-by: neo <neo.dowithless@gmail.com>
2026-03-07 14:48:02 -08:00
Pangerkumzuk Longkumer
da17d33ac3 Fixed CI Workflows Failure fixed (in response to PR#286) (#291)
* Initial plan

* fix: remove malformed copilot-setup-steps.yml and fix hooks.json regex

Co-authored-by: pangerlkr <73515951+pangerlkr@users.noreply.github.com>

---------

Co-authored-by: anthropic-code-agent[bot] <242468646+Claude@users.noreply.github.com>
2026-03-07 14:47:53 -08:00
zzzhizhi
177dd36e23 fix(hooks): allow tmux-wrapped dev server commands (#321)
* fix(hooks): fix shell splitter redirection/escape bugs, extract shared module

- Fix single & incorrectly splitting redirection operators (&>, >&, 2>&1)
- Fix escaped quotes (\", \') not being handled inside quoted strings
- Extract splitShellSegments into shared scripts/lib/shell-split.js
  to eliminate duplication between hooks.json, before-shell-execution.js,
  and pre-bash-dev-server-block.js
- Add comprehensive tests for shell splitting edge cases

* fix(hooks): handle backslash escapes outside quotes in shell splitter

Escaped operators like \&& and \; outside quotes were still being
treated as separators. Add escape handling for unquoted context.
2026-03-07 14:47:49 -08:00
Helbetica
7bed751db0 fix: auto-start dev servers in tmux instead of blocking (#344)
* fix: auto-start development servers in tmux instead of blocking

Replace blocking PreToolUse hook that used process.exit(2) with an auto-transform hook that:
- Detects development server commands
- Wraps them in tmux with directory-based session names
- Runs server detached so Claude Code is not blocked
- Provides confirmation message with log viewing instructions

Benefits:
- Development servers no longer block Claude Code execution
- Each project gets its own tmux session (allows multiple projects)
- Logs remain accessible via 'tmux capture-pane -t <session>'
- Non-blocking: if tmux unavailable, command still runs (graceful fallback)

Implementation:
- Created scripts/hooks/auto-tmux-dev.js with transform logic
- Updated hooks.json to reference the script instead of inline node command
- Applied same fix to cached plugin version (1.4.1) for immediate effect

* fix: resolve PR #344 code review issues in auto-tmux-dev.js

Critical fixes:
- Fix variable scope: declare 'input' before try block, not inside
- Fix shell injection: sanitize sessionName and escape cmd for shell
- Replace unused execFileSync import with spawnSync

Improvements:
- Add real Windows support using cmd /k window launcher
- Add tmux availability check with graceful fallback
- Update header comment to accurately describe platform support

Test coverage:
- Valid JSON input: transforms command for respective platform
- Invalid JSON: passes through raw data unchanged
- Unsupported tools: gracefully falls back to original command
- Shell metacharacters: sanitized in sessionName, escaped in cmd

* fix: correct cmd.exe escape sequence for double quotes on Windows

Use double-quote doubling ('""') instead of backslash-escape ('\\\") for cmd.exe syntax.
Backslash escaping is Unix convention and not recognized by cmd.exe. This fixes quoted
arguments in dev server commands on Windows (e.g., 'npm run dev --filter="my-app"').
2026-03-07 14:47:46 -08:00
Frank
e9577e34f1 fix: force UTF-8 for instinct CLI file IO (#353) 2026-03-07 14:47:35 -08:00
jtzingsheim1
9661a6f042 fix(hooks): scrub secrets and harden hook security (#348)
* fix(hooks): scrub secrets and harden hook security

- Scrub common secret patterns (api_key, token, password, etc.) from
  observation logs before persisting to JSONL (observe.sh)
- Auto-purge observation files older than 30 days (observe.sh)
- Strip embedded credentials from git remote URLs before saving to
  projects.json (detect-project.sh)
- Add command prefix allowlist to runCommand — only git, node, npx,
  which, where are permitted (utils.js)
- Sanitize CLAUDE_SESSION_ID in temp file paths to prevent path
  traversal (suggest-compact.js)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix(hooks): address review feedback from CodeRabbit and Cubic

- Reject shell command-chaining operators (;|&`) in runCommand, strip
  quoted sections before checking to avoid false positives (utils.js)
- Remove command string from blocked error message to avoid leaking
  secrets (utils.js)
- Fix Python regex quoting: switch outer shell string from double to
  single quotes so regex compiles correctly (observe.sh)
- Add optional auth scheme match (Bearer, Basic) to secret scrubber
  regex (observe.sh)
- Scope auto-purge to current project dir and match only archived
  files (observations-*.jsonl), not live queue (observe.sh)
- Add second fallback after session ID sanitization to prevent empty
  string (suggest-compact.js)
- Preserve backward compatibility when credential stripping changes
  project hash — detect and migrate legacy directories
  (detect-project.sh)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix(hooks): block $() substitution, fix Bearer redaction, add security tests

- Add $ and \n to blocked shell metacharacters in runCommand to prevent
  command substitution via $(cmd) and newline injection (utils.js)
- Make auth scheme group capturing so Bearer/Basic is preserved in
  redacted output instead of being silently dropped (observe.sh)
- Add 10 unit tests covering runCommand allowlist blocking (rm, curl,
  bash prefixes) and metacharacter rejection (;|&`$ chaining), plus
  error message leak prevention (utils.test.js)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix(hooks): scrub parse-error fallback, strengthen security tests

Address remaining reviewer feedback from CodeRabbit and Cubic:

- Scrub secrets in observe.sh parse-error fallback path (was writing
  raw unsanitized input to observations file)
- Remove redundant re.IGNORECASE flag ((?i) inline flag already set)
- Add inline comment documenting quote-stripping limitation trade-off
- Fix misleading test name for error-output test
- Add 5 new security tests: single-quote passthrough, mixed
  quoted+unquoted metacharacters, prefix boundary (no trailing space),
  npx acceptance, and newline injection
- Improve existing quoted-metacharacter test to actually exercise
  quote-stripping logic

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix(security): block $() and backtick inside quotes in runCommand

Shell evaluates $() and backticks inside double quotes, so checking
only the unquoted portion was insufficient. Now $ and ` are rejected
anywhere in the command string, while ; | & remain quote-aware.

Addresses CodeRabbit and Cubic review feedback on PR #348.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-07 14:47:31 -08:00
Sense_wang
03b3e0d0da docs: add upstream tracking flag to push example (#327)
Co-authored-by: Hao Wang <haosen.wang@example.com>
2026-03-05 15:36:36 -08:00
Rohit Garg
9dfe149310 Add videodb in readme's folder structure 2026-03-03 18:24:39 +05:30
Rohit Garg
179a0272d1 videodb skills update: add reference files for videodb skills 2026-03-03 18:20:30 +05:30
Rohit Garg
cff0308568 videodb skills update: add reference files for videodb skills 2026-03-03 18:16:39 +05:30
Rohit Garg
c26ba60003 Add VideoDB Skills to Individual Skills 2026-02-27 22:13:59 +05:30
nocodemf
fb94c645f7 fix: address CodeRabbit review feedback
- Rename SKILL.md to <skill-name>.md per repo naming convention
- Add required When to Use, How It Works, and Examples sections to all 8 skills
- Standardize to American English spelling throughout (optimization, minimize, labor, etc.)
- Fix "different than" to "different from" in returns-reverse-logistics

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-25 18:07:07 +03:00
nocodemf
6e48f43e4e feat(skills): Add 8 operational domain skills from Evos
Adds eval-verified skills for logistics, manufacturing, retail, and
energy operations. Each codifies 15+ years of real industry expertise.

Source: https://github.com/ai-evos/agent-skills
License: Apache-2.0
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-25 17:53:26 +03:00
nocodemf
82fa0bc03d Add 8 operational domain skills from Evos
Adds skills covering logistics, manufacturing, retail, and energy
operations. Each codifies 15+ years of real industry expertise.

Skills: logistics-exception-management, carrier-relationship-management,
customs-trade-compliance, inventory-demand-planning, returns-reverse-logistics,
production-scheduling, quality-nonconformance, energy-procurement

Source: https://github.com/ai-evos/agent-skills
License: Apache-2.0
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-25 17:37:54 +03:00
172 changed files with 21905 additions and 4227 deletions

View File

@@ -3,3 +3,15 @@
If you plan to edit `.claude-plugin/plugin.json`, be aware that the Claude plugin validator enforces several **undocumented but strict constraints** that can cause installs to fail with vague errors (for example, `agents: Invalid input`). In particular, component fields must be arrays, `agents` must use explicit file paths rather than directories, and a `version` field is required for reliable validation and installation.
These constraints are not obvious from public examples and have caused repeated installation failures in the past. They are documented in detail in `.claude-plugin/PLUGIN_SCHEMA_NOTES.md`, which should be reviewed before making any changes to the plugin manifest.
### Custom Endpoints and Gateways
ECC does not override Claude Code transport settings. If Claude Code is configured to run through an official LLM gateway or a compatible custom endpoint, the plugin continues to work because hooks, commands, and skills execute locally after the CLI starts successfully.
Use Claude Code's own environment/configuration for transport selection, for example:
```bash
export ANTHROPIC_BASE_URL=https://your-gateway.example.com
export ANTHROPIC_AUTH_TOKEN=your-token
claude
```

View File

@@ -0,0 +1,162 @@
# Curated instincts for affaan-m/everything-claude-code
# Import with: /instinct-import .claude/homunculus/instincts/inherited/everything-claude-code-instincts.yaml
---
id: everything-claude-code-conventional-commits
trigger: "when making a commit in everything-claude-code"
confidence: 0.9
domain: git
source: repo-curation
source_repo: affaan-m/everything-claude-code
---
# Everything Claude Code Conventional Commits
## Action
Use conventional commit prefixes such as `feat:`, `fix:`, `docs:`, `test:`, `chore:`, and `refactor:`.
## Evidence
- Mainline history consistently uses conventional commit subjects.
- Release and changelog automation expect readable commit categorization.
---
id: everything-claude-code-commit-length
trigger: "when writing a commit subject in everything-claude-code"
confidence: 0.8
domain: git
source: repo-curation
source_repo: affaan-m/everything-claude-code
---
# Everything Claude Code Commit Length
## Action
Keep commit subjects concise and close to the repository norm of about 70 characters.
## Evidence
- Recent history clusters around ~70 characters, not ~50.
- Short, descriptive subjects read well in release notes and PR summaries.
---
id: everything-claude-code-js-file-naming
trigger: "when creating a new JavaScript or TypeScript module in everything-claude-code"
confidence: 0.85
domain: code-style
source: repo-curation
source_repo: affaan-m/everything-claude-code
---
# Everything Claude Code JS File Naming
## Action
Prefer camelCase for JavaScript and TypeScript module filenames, and keep skill or command directories in kebab-case.
## Evidence
- `scripts/` and test helpers mostly use camelCase module names.
- `skills/` and `commands/` directories use kebab-case consistently.
---
id: everything-claude-code-test-runner
trigger: "when adding or updating tests in everything-claude-code"
confidence: 0.9
domain: testing
source: repo-curation
source_repo: affaan-m/everything-claude-code
---
# Everything Claude Code Test Runner
## Action
Use the repository's existing Node-based test flow: targeted `*.test.js` files first, then `node tests/run-all.js` or `npm test` for broader verification.
## Evidence
- The repo uses `tests/run-all.js` as the central test orchestrator.
- Test files follow the `*.test.js` naming pattern across hook, CI, and integration coverage.
---
id: everything-claude-code-hooks-change-set
trigger: "when modifying hooks or hook-adjacent behavior in everything-claude-code"
confidence: 0.88
domain: workflow
source: repo-curation
source_repo: affaan-m/everything-claude-code
---
# Everything Claude Code Hooks Change Set
## Action
Update the hook script, its configuration, its tests, and its user-facing documentation together.
## Evidence
- Hook fixes routinely span `hooks/hooks.json`, `scripts/hooks/`, `tests/hooks/`, `tests/integration/`, and `hooks/README.md`.
- Partial hook changes are a common source of regressions and stale docs.
---
id: everything-claude-code-cross-platform-sync
trigger: "when shipping a user-visible feature across ECC surfaces"
confidence: 0.9
domain: workflow
source: repo-curation
source_repo: affaan-m/everything-claude-code
---
# Everything Claude Code Cross Platform Sync
## Action
Treat the root repo as the source of truth, then mirror shipped changes to `.cursor/`, `.codex/`, `.opencode/`, and `.agents/` only where the feature actually exists.
## Evidence
- ECC maintains multiple harness-specific surfaces with overlapping but not identical files.
- The safest workflow is root-first followed by explicit parity updates.
---
id: everything-claude-code-release-sync
trigger: "when preparing a release for everything-claude-code"
confidence: 0.86
domain: workflow
source: repo-curation
source_repo: affaan-m/everything-claude-code
---
# Everything Claude Code Release Sync
## Action
Keep package versions, plugin manifests, and release-facing docs synchronized before publishing.
## Evidence
- Release work spans `package.json`, `.claude-plugin/*`, `.opencode/package.json`, and release-note content.
- Version drift causes broken update paths and confusing install surfaces.
---
id: everything-claude-code-learning-curation
trigger: "when importing or evolving instincts for everything-claude-code"
confidence: 0.84
domain: workflow
source: repo-curation
source_repo: affaan-m/everything-claude-code
---
# Everything Claude Code Learning Curation
## Action
Prefer a small set of accurate instincts over bulk-generated, duplicated, or contradictory instincts.
## Evidence
- Auto-generated instinct dumps can duplicate rules, widen triggers too far, or preserve placeholder detector output.
- Curated instincts are easier to import, audit, and trust during continuous-learning workflows.

View File

@@ -0,0 +1,97 @@
# Everything Claude Code
Use this skill when working inside the `everything-claude-code` repository and you need repo-specific guidance instead of generic coding advice.
Optional companion instincts live at `.claude/homunculus/instincts/inherited/everything-claude-code-instincts.yaml` for teams using `continuous-learning-v2`.
## When to Use
Activate this skill when the task touches one or more of these areas:
- cross-platform parity across Claude Code, Cursor, Codex, and OpenCode
- hook scripts, hook docs, or hook tests
- skills, commands, agents, or rules that must stay synchronized across surfaces
- release work such as version bumps, changelog updates, or plugin metadata updates
- continuous-learning or instinct workflows inside this repository
## How It Works
### 1. Follow the repo's development contract
- Use conventional commits such as `feat:`, `fix:`, `docs:`, `test:`, `chore:`.
- Keep commit subjects concise and close to the repo norm of about 70 characters.
- Prefer camelCase for JavaScript and TypeScript module filenames.
- Use kebab-case for skill directories and command filenames.
- Keep test files on the existing `*.test.js` pattern.
### 2. Treat the root repo as the source of truth
Start from the root implementation, then mirror changes where they are intentionally shipped.
Typical mirror targets:
- `.cursor/`
- `.codex/`
- `.opencode/`
- `.agents/`
Do not assume every `.claude/` artifact needs a cross-platform copy. Only mirror files that are part of the shipped multi-platform surface.
### 3. Update hooks with tests and docs together
When changing hook behavior:
1. update `hooks/hooks.json` or the relevant script in `scripts/hooks/`
2. update matching tests in `tests/hooks/` or `tests/integration/`
3. update `hooks/README.md` if behavior or configuration changed
4. verify parity for `.cursor/hooks/` and `.opencode/plugins/` when applicable
### 4. Keep release metadata in sync
When preparing a release, verify the same version is reflected anywhere it is surfaced:
- `package.json`
- `.claude-plugin/plugin.json`
- `.claude-plugin/marketplace.json`
- `.opencode/package.json`
- release notes or changelog entries when the release process expects them
### 5. Be explicit about continuous-learning changes
If the task touches `skills/continuous-learning-v2/` or imported instincts:
- prefer accurate, low-noise instincts over auto-generated bulk output
- keep instinct files importable by `instinct-cli.py`
- remove duplicated or contradictory instincts instead of layering more guidance on top
## Examples
### Naming examples
```text
skills/continuous-learning-v2/SKILL.md
commands/update-docs.md
scripts/hooks/session-start.js
tests/hooks/hooks.test.js
```
### Commit examples
```text
fix: harden session summary extraction on Stop hook
docs: align Codex config examples with current schema
test: cover Windows formatter fallback behavior
```
### Skill update checklist
```text
1. Update the root skill or command.
2. Mirror it only where that surface is shipped.
3. Run targeted tests first, then the broader suite if behavior changed.
4. Review docs and release notes for user-visible changes.
```
### Release checklist
```text
1. Bump package and plugin versions.
2. Run npm test.
3. Verify platform-specific manifests.
4. Publish the release notes with a human-readable summary.
```

View File

@@ -6,10 +6,10 @@ This supplements the root `AGENTS.md` with Codex-specific guidance.
| Task Type | Recommended Model |
|-----------|------------------|
| Routine coding, tests, formatting | o4-mini |
| Complex features, architecture | o3 |
| Debugging, refactoring | o4-mini |
| Security review | o3 |
| Routine coding, tests, formatting | GPT 5.4 |
| Complex features, architecture | GPT 5.4 |
| Debugging, refactoring | GPT 5.4 |
| Security review | GPT 5.4 |
## Skills Discovery
@@ -39,6 +39,20 @@ Available skills:
Configure in `~/.codex/config.toml` under `[mcp_servers]`. See `.codex/config.toml` for reference configuration with GitHub, Context7, Memory, and Sequential Thinking servers.
## Multi-Agent Support
Codex now supports multi-agent workflows behind the experimental `features.multi_agent` flag.
- Enable it in `.codex/config.toml` with `[features] multi_agent = true`
- Define project-local roles under `[agents.<name>]`
- Point each role at a TOML layer under `.codex/agents/`
- Use `/agent` inside Codex CLI to inspect and steer child agents
Sample role configs in this repo:
- `.codex/agents/explorer.toml` — read-only evidence gathering
- `.codex/agents/reviewer.toml` — correctness/security review
- `.codex/agents/docs-researcher.toml` — API and release-note verification
## Key Differences from Claude Code
| Feature | Claude Code | Codex CLI |
@@ -47,7 +61,7 @@ Configure in `~/.codex/config.toml` under `[mcp_servers]`. See `.codex/config.to
| Context file | CLAUDE.md + AGENTS.md | AGENTS.md only |
| Skills | Skills loaded via plugin | `.agents/skills/` directory |
| Commands | `/slash` commands | Instruction-based |
| Agents | Subagent Task tool | Single agent model |
| Agents | Subagent Task tool | Multi-agent via `/agent` and `[agents.<name>]` roles |
| Security | Hook-based enforcement | Instruction + sandbox |
| MCP | Full support | Command-based only |

View File

@@ -0,0 +1,9 @@
model = "gpt-5.4"
model_reasoning_effort = "medium"
sandbox_mode = "read-only"
developer_instructions = """
Verify APIs, framework behavior, and release-note claims against primary documentation before changes land.
Cite the exact docs or file paths that support each claim.
Do not invent undocumented behavior.
"""

View File

@@ -0,0 +1,9 @@
model = "gpt-5.4"
model_reasoning_effort = "medium"
sandbox_mode = "read-only"
developer_instructions = """
Stay in exploration mode.
Trace the real execution path, cite files and symbols, and avoid proposing fixes unless the parent agent asks for them.
Prefer targeted search and file reads over broad scans.
"""

View File

@@ -0,0 +1,9 @@
model = "gpt-5.4"
model_reasoning_effort = "high"
sandbox_mode = "read-only"
developer_instructions = """
Review like an owner.
Prioritize correctness, security, behavioral regressions, and missing tests.
Lead with concrete findings and avoid style-only feedback unless it hides a real bug.
"""

View File

@@ -1,42 +1,38 @@
# Everything Claude Code (ECC) — Codex CLI Reference Configuration
#:schema https://developers.openai.com/codex/config-schema.json
# Everything Claude Code (ECC) — Codex Reference Configuration
#
# Copy this file to ~/.codex/config.toml to apply globally.
# Or keep it in your project root for project-level config.
# Copy this file to ~/.codex/config.toml for global defaults, or keep it in
# the project root as .codex/config.toml for project-local settings.
#
# Docs: https://github.com/openai/codex
# Official docs:
# - https://developers.openai.com/codex/config-reference
# - https://developers.openai.com/codex/multi-agent
# Model selection
model = "o4-mini"
model_provider = "openai"
# Leave `model` and `model_provider` unset so Codex CLI uses its current
# built-in defaults. Uncomment and pin them only if you intentionally want
# repo-local or global model overrides.
# Permissions
[permissions]
# "untrusted" = no writes, "on-request" = ask per action, "never" = full auto
# Top-level runtime settings (current Codex schema)
approval_policy = "on-request"
# "off", "workspace-read", "workspace-write", "danger-full-access"
sandbox_mode = "workspace-write"
web_search = "live"
# Notifications (macOS)
[notify]
command = "terminal-notifier -title 'Codex ECC' -message 'Task completed!' -sound default"
on_complete = true
# External notifications receive a JSON payload on stdin.
notify = [
"terminal-notifier",
"-title", "Codex ECC",
"-message", "Task completed!",
"-sound", "default",
]
# History - persistent instructions applied to every session
[history]
# These are prepended to every conversation
persistent_instructions = """
Follow ECC principles:
1. Test-Driven Development (TDD) - write tests first, 80%+ coverage required
2. Immutability - always create new objects, never mutate
3. Security-First - validate all inputs, no hardcoded secrets
4. Conventional commits: feat|fix|refactor|docs|test|chore|perf|ci: description
5. File organization: many small files (200-400 lines, 800 max)
6. Error handling: handle at every level, never swallow errors
7. Input validation: schema-based validation at system boundaries
"""
# Prefer AGENTS.md and project-local .codex/AGENTS.md for instructions.
# model_instructions_file replaces built-in instructions instead of AGENTS.md,
# so leave it unset unless you intentionally want a single override file.
# model_instructions_file = "/absolute/path/to/instructions.md"
# MCP Servers
# Codex supports command-based MCP servers
# MCP servers
[mcp_servers.github]
command = "npx"
args = ["-y", "@modelcontextprotocol/server-github"]
@@ -62,19 +58,41 @@ args = ["-y", "@modelcontextprotocol/server-sequential-thinking"]
# command = "npx"
# args = ["-y", "firecrawl-mcp"]
#
# [mcp_servers.railway]
# [mcp_servers.cloudflare]
# command = "npx"
# args = ["-y", "@anthropic/railway-mcp"]
# args = ["-y", "@cloudflare/mcp-server-cloudflare"]
# Features
[features]
web_search_request = true
# Codex multi-agent support is experimental as of March 2026.
multi_agent = true
# Profiles — switch with CODEX_PROFILE=<name>
# Profiles — switch with `codex -p <name>`
[profiles.strict]
approval_policy = "on-request"
sandbox_mode = "workspace-read"
sandbox_mode = "read-only"
web_search = "cached"
[profiles.yolo]
approval_policy = "never"
sandbox_mode = "workspace-write"
web_search = "live"
# Optional project-local multi-agent roles.
# Keep these commented in global config, because config_file paths are resolved
# relative to the config.toml file and must exist at load time.
#
# [agents]
# max_threads = 6
# max_depth = 1
#
# [agents.explorer]
# description = "Read-only codebase explorer for gathering evidence before changes are proposed."
# config_file = "agents/explorer.toml"
#
# [agents.reviewer]
# description = "PR reviewer focused on correctness, security, and missing tests."
# config_file = "agents/reviewer.toml"
#
# [agents.docs_researcher]
# description = "Documentation specialist that verifies APIs, framework behavior, and release notes."
# config_file = "agents/docs-researcher.toml"

View File

@@ -1,72 +1,41 @@
#!/usr/bin/env node
const { readStdin, hookEnabled } = require('./adapter');
const { splitShellSegments } = require('../../scripts/lib/shell-split');
function splitShellSegments(command) {
const segments = [];
let current = '';
let quote = null;
readStdin()
.then(raw => {
try {
const input = JSON.parse(raw || '{}');
const cmd = String(input.command || input.args?.command || '');
for (let i = 0; i < command.length; i++) {
const ch = command[i];
if (quote) {
if (ch === quote) quote = null;
current += ch;
continue;
}
if (ch === '"' || ch === "'") {
quote = ch;
current += ch;
continue;
}
const next = command[i + 1] || '';
if (ch === ';' || (ch === '&' && next === '&') || (ch === '|' && next === '|') || (ch === '&' && next !== '&')) {
if (current.trim()) segments.push(current.trim());
current = '';
if ((ch === '&' && next === '&') || (ch === '|' && next === '|')) i++;
continue;
}
current += ch;
}
if (current.trim()) segments.push(current.trim());
return segments;
}
readStdin().then(raw => {
try {
const input = JSON.parse(raw || '{}');
const cmd = String(input.command || input.args?.command || '');
if (hookEnabled('pre:bash:dev-server-block', ['standard', 'strict']) && process.platform !== 'win32') {
const segments = splitShellSegments(cmd);
const tmuxLauncher = /^\s*tmux\s+(new|new-session|new-window|split-window)\b/;
const devPattern = /\b(npm\s+run\s+dev|pnpm(?:\s+run)?\s+dev|yarn\s+dev|bun\s+run\s+dev)\b/;
const hasBlockedDev = segments.some(segment => devPattern.test(segment) && !tmuxLauncher.test(segment));
if (hasBlockedDev) {
console.error('[ECC] BLOCKED: Dev server must run in tmux for log access');
console.error('[ECC] Use: tmux new-session -d -s dev "npm run dev"');
process.exit(2);
if (hookEnabled('pre:bash:dev-server-block', ['standard', 'strict']) && process.platform !== 'win32') {
const segments = splitShellSegments(cmd);
const tmuxLauncher = /^\s*tmux\s+(new|new-session|new-window|split-window)\b/;
const devPattern = /\b(npm\s+run\s+dev|pnpm(?:\s+run)?\s+dev|yarn\s+dev|bun\s+run\s+dev)\b/;
const hasBlockedDev = segments.some(segment => devPattern.test(segment) && !tmuxLauncher.test(segment));
if (hasBlockedDev) {
console.error('[ECC] BLOCKED: Dev server must run in tmux for log access');
console.error('[ECC] Use: tmux new-session -d -s dev "npm run dev"');
process.exit(2);
}
}
if (
hookEnabled('pre:bash:tmux-reminder', ['strict']) &&
process.platform !== 'win32' &&
!process.env.TMUX &&
/(npm (install|test)|pnpm (install|test)|yarn (install|test)?|bun (install|test)|cargo build|make\b|docker\b|pytest|vitest|playwright)/.test(cmd)
) {
console.error('[ECC] Consider running in tmux for session persistence');
}
if (hookEnabled('pre:bash:git-push-reminder', ['strict']) && /\bgit\s+push\b/.test(cmd)) {
console.error('[ECC] Review changes before push: git diff origin/main...HEAD');
}
} catch {
// noop
}
if (
hookEnabled('pre:bash:tmux-reminder', ['strict']) &&
process.platform !== 'win32' &&
!process.env.TMUX &&
/(npm (install|test)|pnpm (install|test)|yarn (install|test)?|bun (install|test)|cargo build|make\b|docker\b|pytest|vitest|playwright)/.test(cmd)
) {
console.error('[ECC] Consider running in tmux for session persistence');
}
if (hookEnabled('pre:bash:git-push-reminder', ['strict']) && /\bgit\s+push\b/.test(cmd)) {
console.error('[ECC] Review changes before push: git diff origin/main...HEAD');
}
} catch {
// noop
}
process.stdout.write(raw);
}).catch(() => process.exit(0));
process.stdout.write(raw);
})
.catch(() => process.exit(0));

View File

@@ -0,0 +1,25 @@
---
description: "PHP coding style extending common rules"
globs: ["**/*.php", "**/composer.json"]
alwaysApply: false
---
# PHP Coding Style
> This file extends the common coding style rule with PHP specific content.
## Standards
- Follow **PSR-12** formatting and naming conventions.
- Prefer `declare(strict_types=1);` in application code.
- Use scalar type hints, return types, and typed properties everywhere new code permits.
## Immutability
- Prefer immutable DTOs and value objects for data crossing service boundaries.
- Use `readonly` properties or immutable constructors for request/response payloads where possible.
- Keep arrays for simple maps; promote business-critical structures into explicit classes.
## Formatting
- Use **PHP-CS-Fixer** or **Laravel Pint** for formatting.
- Use **PHPStan** or **Psalm** for static analysis.

View File

@@ -0,0 +1,21 @@
---
description: "PHP hooks extending common rules"
globs: ["**/*.php", "**/composer.json", "**/phpstan.neon", "**/phpstan.neon.dist", "**/psalm.xml"]
alwaysApply: false
---
# PHP Hooks
> This file extends the common hooks rule with PHP specific content.
## PostToolUse Hooks
Configure in `~/.claude/settings.json`:
- **Pint / PHP-CS-Fixer**: Auto-format edited `.php` files.
- **PHPStan / Psalm**: Run static analysis after PHP edits in typed codebases.
- **PHPUnit / Pest**: Run targeted tests for touched files or modules when edits affect behavior.
## Warnings
- Warn on `var_dump`, `dd`, `dump`, or `die()` left in edited files.
- Warn when edited PHP files add raw SQL or disable CSRF/session protections.

View File

@@ -0,0 +1,23 @@
---
description: "PHP patterns extending common rules"
globs: ["**/*.php", "**/composer.json"]
alwaysApply: false
---
# PHP Patterns
> This file extends the common patterns rule with PHP specific content.
## Thin Controllers, Explicit Services
- Keep controllers focused on transport: auth, validation, serialization, status codes.
- Move business rules into application/domain services that are easy to test without HTTP bootstrapping.
## DTOs and Value Objects
- Replace shape-heavy associative arrays with DTOs for requests, commands, and external API payloads.
- Use value objects for money, identifiers, and constrained concepts.
## Dependency Injection
- Depend on interfaces or narrow service contracts, not framework globals.
- Pass collaborators through constructors so services are testable without service-locator lookups.

View File

@@ -0,0 +1,24 @@
---
description: "PHP security extending common rules"
globs: ["**/*.php", "**/composer.lock", "**/composer.json"]
alwaysApply: false
---
# PHP Security
> This file extends the common security rule with PHP specific content.
## Database Safety
- Use prepared statements (`PDO`, Doctrine, Eloquent query builder) for all dynamic queries.
- Scope ORM mass-assignment carefully and whitelist writable fields.
## Secrets and Dependencies
- Load secrets from environment variables or a secret manager, never from committed config files.
- Run `composer audit` in CI and review package trust before adding dependencies.
## Auth and Session Safety
- Use `password_hash()` / `password_verify()` for password storage.
- Regenerate session identifiers after authentication and privilege changes.
- Enforce CSRF protection on state-changing web requests.

View File

@@ -0,0 +1,26 @@
---
description: "PHP testing extending common rules"
globs: ["**/*.php", "**/phpunit.xml", "**/phpunit.xml.dist", "**/composer.json"]
alwaysApply: false
---
# PHP Testing
> This file extends the common testing rule with PHP specific content.
## Framework
Use **PHPUnit** as the default test framework. **Pest** is also acceptable when the project already uses it.
## Coverage
```bash
vendor/bin/phpunit --coverage-text
# or
vendor/bin/pest --coverage
```
## Test Organization
- Separate fast unit tests from framework/database integration tests.
- Use factory/builders for fixtures instead of large hand-written arrays.
- Keep HTTP/controller tests focused on transport and validation; move business rules into service-level tests.

View File

@@ -156,6 +156,9 @@ jobs:
with:
node-version: '20.x'
- name: Install validation dependencies
run: npm ci --ignore-scripts
- name: Validate agents
run: node scripts/ci/validate-agents.js
continue-on-error: false

View File

@@ -24,6 +24,9 @@ jobs:
with:
node-version: ${{ inputs.node-version }}
- name: Install validation dependencies
run: npm ci --ignore-scripts
- name: Validate agents
run: node scripts/ci/validate-agents.js

1
.gitignore vendored
View File

@@ -23,6 +23,7 @@ node_modules/
# Build output
dist/
coverage/
# Python
__pycache__/

View File

@@ -148,7 +148,7 @@ You are an expert planning specialist...
"description": "Expert planning specialist...",
"mode": "subagent",
"model": "anthropic/claude-opus-4-5",
"prompt": "{file:.opencode/prompts/agents/planner.txt}",
"prompt": "{file:prompts/agents/planner.txt}",
"tools": { "read": true, "bash": true }
}
}
@@ -213,7 +213,7 @@ Create a detailed implementation plan for: $ARGUMENTS
```json
{
"instructions": [
".opencode/instructions/INSTRUCTIONS.md",
"instructions/INSTRUCTIONS.md",
"rules/common/security.md",
"rules/common/coding-style.md"
]
@@ -297,6 +297,15 @@ Then in your `opencode.json`:
}
```
This only loads the published ECC OpenCode plugin module (hooks/events and exported plugin tools).
It does **not** automatically inject ECC's full `agent`, `command`, or `instructions` config into your project.
If you want the full ECC OpenCode workflow surface, use the repository's bundled `.opencode/opencode.json` as your base config or copy these pieces into your project:
- `.opencode/commands/`
- `.opencode/prompts/`
- `.opencode/instructions/INSTRUCTIONS.md`
- the `agent` and `command` sections from `.opencode/opencode.json`
## Troubleshooting
### Configuration Not Loading
@@ -322,6 +331,7 @@ Then in your `opencode.json`:
1. Verify the command is defined in `opencode.json` or as `.md` file in `.opencode/commands/`
2. Check the referenced agent exists
3. Ensure the template uses `$ARGUMENTS` for user input
4. If you installed only `plugin: ["ecc-universal"]`, note that npm plugin install does not auto-add ECC commands or agents to your project config
## Best Practices

View File

@@ -32,7 +32,16 @@ Add to your `opencode.json`:
"plugin": ["ecc-universal"]
}
```
After installation, the `ecc-install` CLI becomes available:
This loads the ECC OpenCode plugin module from npm:
- hook/event integrations
- bundled custom tools exported by the plugin
It does **not** auto-register the full ECC command/agent/instruction catalog in your project config. For the full OpenCode setup, either:
- run OpenCode inside this repository, or
- copy the relevant `.opencode/commands/`, `.opencode/prompts/`, `.opencode/instructions/`, and the `instructions`, `agent`, and `command` config entries into your own project
After installation, the `ecc-install` CLI is also available:
```bash
npx ecc-install typescript
@@ -180,7 +189,7 @@ Full configuration in `opencode.json`:
"$schema": "https://opencode.ai/config.json",
"model": "anthropic/claude-sonnet-4-5",
"small_model": "anthropic/claude-haiku-4-5",
"plugin": ["./.opencode/plugins"],
"plugin": ["./plugins"],
"instructions": [
"skills/tdd-workflow/SKILL.md",
"skills/security-review/SKILL.md"

View File

@@ -1,12 +1,10 @@
/**
* Everything Claude Code (ECC) Plugin for OpenCode
*
* This package provides a complete OpenCode plugin with:
* - 13 specialized agents (planner, architect, code-reviewer, etc.)
* - 31 commands (/plan, /tdd, /code-review, etc.)
* This package provides the published ECC OpenCode plugin module:
* - Plugin hooks (auto-format, TypeScript check, console.log warning, env injection, etc.)
* - Custom tools (run-tests, check-coverage, security-audit, format-code, lint-check, git-summary)
* - 37 skills (coding-standards, security-review, tdd-workflow, etc.)
* - Bundled reference config/assets for the wider ECC OpenCode setup
*
* Usage:
*
@@ -22,6 +20,10 @@
* }
* ```
*
* That enables the published plugin module only. For ECC commands, agents,
* prompts, and instructions, use this repository's `.opencode/opencode.json`
* as a base or copy the bundled `.opencode/` assets into your project.
*
* Option 2: Clone and use directly
* ```bash
* git clone https://github.com/affaan-m/everything-claude-code
@@ -51,6 +53,7 @@ export const metadata = {
agents: 13,
commands: 31,
skills: 37,
configAssets: true,
hookEvents: [
"file.edited",
"tool.execute.before",

View File

@@ -6,7 +6,7 @@
"instructions": [
"AGENTS.md",
"CONTRIBUTING.md",
".opencode/instructions/INSTRUCTIONS.md",
"instructions/INSTRUCTIONS.md",
"skills/tdd-workflow/SKILL.md",
"skills/security-review/SKILL.md",
"skills/coding-standards/SKILL.md",
@@ -20,7 +20,7 @@
"skills/eval-harness/SKILL.md"
],
"plugin": [
"./.opencode/plugins"
"./plugins"
],
"agent": {
"build": {
@@ -38,7 +38,7 @@
"description": "Expert planning specialist for complex features and refactoring. Use for implementation planning, architectural changes, or complex refactoring.",
"mode": "subagent",
"model": "anthropic/claude-opus-4-5",
"prompt": "{file:.opencode/prompts/agents/planner.txt}",
"prompt": "{file:prompts/agents/planner.txt}",
"tools": {
"read": true,
"bash": true,
@@ -50,7 +50,7 @@
"description": "Software architecture specialist for system design, scalability, and technical decision-making.",
"mode": "subagent",
"model": "anthropic/claude-opus-4-5",
"prompt": "{file:.opencode/prompts/agents/architect.txt}",
"prompt": "{file:prompts/agents/architect.txt}",
"tools": {
"read": true,
"bash": true,
@@ -62,7 +62,7 @@
"description": "Expert code review specialist. Reviews code for quality, security, and maintainability. Use immediately after writing or modifying code.",
"mode": "subagent",
"model": "anthropic/claude-opus-4-5",
"prompt": "{file:.opencode/prompts/agents/code-reviewer.txt}",
"prompt": "{file:prompts/agents/code-reviewer.txt}",
"tools": {
"read": true,
"bash": true,
@@ -74,7 +74,7 @@
"description": "Security vulnerability detection and remediation specialist. Use after writing code that handles user input, authentication, API endpoints, or sensitive data.",
"mode": "subagent",
"model": "anthropic/claude-opus-4-5",
"prompt": "{file:.opencode/prompts/agents/security-reviewer.txt}",
"prompt": "{file:prompts/agents/security-reviewer.txt}",
"tools": {
"read": true,
"bash": true,
@@ -86,7 +86,7 @@
"description": "Test-Driven Development specialist enforcing write-tests-first methodology. Use when writing new features, fixing bugs, or refactoring code. Ensures 80%+ test coverage.",
"mode": "subagent",
"model": "anthropic/claude-opus-4-5",
"prompt": "{file:.opencode/prompts/agents/tdd-guide.txt}",
"prompt": "{file:prompts/agents/tdd-guide.txt}",
"tools": {
"read": true,
"write": true,
@@ -98,7 +98,7 @@
"description": "Build and TypeScript error resolution specialist. Use when build fails or type errors occur. Fixes build/type errors only with minimal diffs.",
"mode": "subagent",
"model": "anthropic/claude-opus-4-5",
"prompt": "{file:.opencode/prompts/agents/build-error-resolver.txt}",
"prompt": "{file:prompts/agents/build-error-resolver.txt}",
"tools": {
"read": true,
"write": true,
@@ -110,7 +110,7 @@
"description": "End-to-end testing specialist using Playwright. Generates, maintains, and runs E2E tests for critical user flows.",
"mode": "subagent",
"model": "anthropic/claude-opus-4-5",
"prompt": "{file:.opencode/prompts/agents/e2e-runner.txt}",
"prompt": "{file:prompts/agents/e2e-runner.txt}",
"tools": {
"read": true,
"write": true,
@@ -122,7 +122,7 @@
"description": "Documentation and codemap specialist. Use for updating codemaps and documentation.",
"mode": "subagent",
"model": "anthropic/claude-opus-4-5",
"prompt": "{file:.opencode/prompts/agents/doc-updater.txt}",
"prompt": "{file:prompts/agents/doc-updater.txt}",
"tools": {
"read": true,
"write": true,
@@ -134,7 +134,7 @@
"description": "Dead code cleanup and consolidation specialist. Use for removing unused code, duplicates, and refactoring.",
"mode": "subagent",
"model": "anthropic/claude-opus-4-5",
"prompt": "{file:.opencode/prompts/agents/refactor-cleaner.txt}",
"prompt": "{file:prompts/agents/refactor-cleaner.txt}",
"tools": {
"read": true,
"write": true,
@@ -146,7 +146,7 @@
"description": "Expert Go code reviewer specializing in idiomatic Go, concurrency patterns, error handling, and performance.",
"mode": "subagent",
"model": "anthropic/claude-opus-4-5",
"prompt": "{file:.opencode/prompts/agents/go-reviewer.txt}",
"prompt": "{file:prompts/agents/go-reviewer.txt}",
"tools": {
"read": true,
"bash": true,
@@ -158,7 +158,7 @@
"description": "Go build, vet, and compilation error resolution specialist. Fixes Go build errors with minimal changes.",
"mode": "subagent",
"model": "anthropic/claude-opus-4-5",
"prompt": "{file:.opencode/prompts/agents/go-build-resolver.txt}",
"prompt": "{file:prompts/agents/go-build-resolver.txt}",
"tools": {
"read": true,
"write": true,
@@ -170,7 +170,7 @@
"description": "PostgreSQL database specialist for query optimization, schema design, security, and performance. Incorporates Supabase best practices.",
"mode": "subagent",
"model": "anthropic/claude-opus-4-5",
"prompt": "{file:.opencode/prompts/agents/database-reviewer.txt}",
"prompt": "{file:prompts/agents/database-reviewer.txt}",
"tools": {
"read": true,
"write": true,
@@ -182,135 +182,135 @@
"command": {
"plan": {
"description": "Create a detailed implementation plan for complex features",
"template": "{file:.opencode/commands/plan.md}\n\n$ARGUMENTS",
"template": "{file:commands/plan.md}\n\n$ARGUMENTS",
"agent": "planner",
"subtask": true
},
"tdd": {
"description": "Enforce TDD workflow with 80%+ test coverage",
"template": "{file:.opencode/commands/tdd.md}\n\n$ARGUMENTS",
"template": "{file:commands/tdd.md}\n\n$ARGUMENTS",
"agent": "tdd-guide",
"subtask": true
},
"code-review": {
"description": "Review code for quality, security, and maintainability",
"template": "{file:.opencode/commands/code-review.md}\n\n$ARGUMENTS",
"template": "{file:commands/code-review.md}\n\n$ARGUMENTS",
"agent": "code-reviewer",
"subtask": true
},
"security": {
"description": "Run comprehensive security review",
"template": "{file:.opencode/commands/security.md}\n\n$ARGUMENTS",
"template": "{file:commands/security.md}\n\n$ARGUMENTS",
"agent": "security-reviewer",
"subtask": true
},
"build-fix": {
"description": "Fix build and TypeScript errors with minimal changes",
"template": "{file:.opencode/commands/build-fix.md}\n\n$ARGUMENTS",
"template": "{file:commands/build-fix.md}\n\n$ARGUMENTS",
"agent": "build-error-resolver",
"subtask": true
},
"e2e": {
"description": "Generate and run E2E tests with Playwright",
"template": "{file:.opencode/commands/e2e.md}\n\n$ARGUMENTS",
"template": "{file:commands/e2e.md}\n\n$ARGUMENTS",
"agent": "e2e-runner",
"subtask": true
},
"refactor-clean": {
"description": "Remove dead code and consolidate duplicates",
"template": "{file:.opencode/commands/refactor-clean.md}\n\n$ARGUMENTS",
"template": "{file:commands/refactor-clean.md}\n\n$ARGUMENTS",
"agent": "refactor-cleaner",
"subtask": true
},
"orchestrate": {
"description": "Orchestrate multiple agents for complex tasks",
"template": "{file:.opencode/commands/orchestrate.md}\n\n$ARGUMENTS",
"template": "{file:commands/orchestrate.md}\n\n$ARGUMENTS",
"agent": "planner",
"subtask": true
},
"learn": {
"description": "Extract patterns and learnings from session",
"template": "{file:.opencode/commands/learn.md}\n\n$ARGUMENTS"
"template": "{file:commands/learn.md}\n\n$ARGUMENTS"
},
"checkpoint": {
"description": "Save verification state and progress",
"template": "{file:.opencode/commands/checkpoint.md}\n\n$ARGUMENTS"
"template": "{file:commands/checkpoint.md}\n\n$ARGUMENTS"
},
"verify": {
"description": "Run verification loop",
"template": "{file:.opencode/commands/verify.md}\n\n$ARGUMENTS"
"template": "{file:commands/verify.md}\n\n$ARGUMENTS"
},
"eval": {
"description": "Run evaluation against criteria",
"template": "{file:.opencode/commands/eval.md}\n\n$ARGUMENTS"
"template": "{file:commands/eval.md}\n\n$ARGUMENTS"
},
"update-docs": {
"description": "Update documentation",
"template": "{file:.opencode/commands/update-docs.md}\n\n$ARGUMENTS",
"template": "{file:commands/update-docs.md}\n\n$ARGUMENTS",
"agent": "doc-updater",
"subtask": true
},
"update-codemaps": {
"description": "Update codemaps",
"template": "{file:.opencode/commands/update-codemaps.md}\n\n$ARGUMENTS",
"template": "{file:commands/update-codemaps.md}\n\n$ARGUMENTS",
"agent": "doc-updater",
"subtask": true
},
"test-coverage": {
"description": "Analyze test coverage",
"template": "{file:.opencode/commands/test-coverage.md}\n\n$ARGUMENTS",
"template": "{file:commands/test-coverage.md}\n\n$ARGUMENTS",
"agent": "tdd-guide",
"subtask": true
},
"setup-pm": {
"description": "Configure package manager",
"template": "{file:.opencode/commands/setup-pm.md}\n\n$ARGUMENTS"
"template": "{file:commands/setup-pm.md}\n\n$ARGUMENTS"
},
"go-review": {
"description": "Go code review",
"template": "{file:.opencode/commands/go-review.md}\n\n$ARGUMENTS",
"template": "{file:commands/go-review.md}\n\n$ARGUMENTS",
"agent": "go-reviewer",
"subtask": true
},
"go-test": {
"description": "Go TDD workflow",
"template": "{file:.opencode/commands/go-test.md}\n\n$ARGUMENTS",
"template": "{file:commands/go-test.md}\n\n$ARGUMENTS",
"agent": "tdd-guide",
"subtask": true
},
"go-build": {
"description": "Fix Go build errors",
"template": "{file:.opencode/commands/go-build.md}\n\n$ARGUMENTS",
"template": "{file:commands/go-build.md}\n\n$ARGUMENTS",
"agent": "go-build-resolver",
"subtask": true
},
"skill-create": {
"description": "Generate skills from git history",
"template": "{file:.opencode/commands/skill-create.md}\n\n$ARGUMENTS"
"template": "{file:commands/skill-create.md}\n\n$ARGUMENTS"
},
"instinct-status": {
"description": "View learned instincts",
"template": "{file:.opencode/commands/instinct-status.md}\n\n$ARGUMENTS"
"template": "{file:commands/instinct-status.md}\n\n$ARGUMENTS"
},
"instinct-import": {
"description": "Import instincts",
"template": "{file:.opencode/commands/instinct-import.md}\n\n$ARGUMENTS"
"template": "{file:commands/instinct-import.md}\n\n$ARGUMENTS"
},
"instinct-export": {
"description": "Export instincts",
"template": "{file:.opencode/commands/instinct-export.md}\n\n$ARGUMENTS"
"template": "{file:commands/instinct-export.md}\n\n$ARGUMENTS"
},
"evolve": {
"description": "Cluster instincts into skills",
"template": "{file:.opencode/commands/evolve.md}\n\n$ARGUMENTS"
"template": "{file:commands/evolve.md}\n\n$ARGUMENTS"
},
"promote": {
"description": "Promote project instincts to global scope",
"template": "{file:.opencode/commands/promote.md}\n\n$ARGUMENTS"
"template": "{file:commands/promote.md}\n\n$ARGUMENTS"
},
"projects": {
"description": "List known projects and instinct stats",
"template": "{file:.opencode/commands/projects.md}\n\n$ARGUMENTS"
"template": "{file:commands/projects.md}\n\n$ARGUMENTS"
}
},
"permission": {

View File

@@ -1,6 +1,6 @@
# Everything Claude Code (ECC) — Agent Instructions
This is a **production-ready AI coding plugin** providing 13 specialized agents, 50+ skills, 33 commands, and automated hook workflows for software development.
This is a **production-ready AI coding plugin** providing 16 specialized agents, 65+ skills, 40 commands, and automated hook workflows for software development.
## Core Principles
@@ -27,6 +27,9 @@ This is a **production-ready AI coding plugin** providing 13 specialized agents,
| go-build-resolver | Go build errors | Go build failures |
| database-reviewer | PostgreSQL/Supabase specialist | Schema design, query optimization |
| python-reviewer | Python code review | Python projects |
| chief-of-staff | Communication triage and drafts | Multi-channel email, Slack, LINE, Messenger |
| loop-operator | Autonomous loop execution | Run loops safely, monitor stalls, intervene |
| harness-optimizer | Harness config tuning | Reliability, cost, throughput |
## Agent Orchestration
@@ -36,6 +39,9 @@ Use agents proactively without user prompt:
- Bug fix or new feature → **tdd-guide**
- Architectural decision → **architect**
- Security-sensitive code → **security-reviewer**
- Multi-channel communication triage → **chief-of-staff**
- Autonomous loops / loop monitoring → **loop-operator**
- Harness config reliability and cost → **harness-optimizer**
Use parallel execution for independent operations — launch multiple agents simultaneously.
@@ -92,7 +98,12 @@ Troubleshoot failures: check test isolation → verify mocks → fix implementat
1. **Plan** — Use planner agent, identify dependencies and risks, break into phases
2. **TDD** — Use tdd-guide agent, write tests first, implement, refactor
3. **Review** — Use code-reviewer agent immediately, address CRITICAL/HIGH issues
4. **Commit** — Conventional commits format, comprehensive PR summaries
4. **Capture knowledge in the right place**
- Personal debugging notes, preferences, and temporary context → auto memory
- Team/project knowledge (architecture decisions, API changes, runbooks) → the project's existing docs structure
- If the current task already produces the relevant docs or code comments, do not duplicate the same information elsewhere
- If there is no obvious project doc location, ask before creating a new top-level file
5. **Commit** — Conventional commits format, comprehensive PR summaries
## Git Workflow
@@ -118,8 +129,8 @@ Troubleshoot failures: check test isolation → verify mocks → fix implementat
```
agents/ — 13 specialized subagents
skills/ — 50+ workflow skills and domain knowledge
commands/ — 33 slash commands
skills/ — 65+ workflow skills and domain knowledge
commands/ — 40 slash commands
hooks/ — Trigger-based automations
rules/ — Always-follow guidelines (common + per-language)
scripts/ — Cross-platform Node.js utilities

View File

@@ -10,6 +10,7 @@ Thanks for wanting to contribute! This repo is a community resource for Claude C
- [Contributing Agents](#contributing-agents)
- [Contributing Hooks](#contributing-hooks)
- [Contributing Commands](#contributing-commands)
- [Cross-Harness and Translations](#cross-harness-and-translations)
- [Pull Request Process](#pull-request-process)
---
@@ -348,6 +349,29 @@ What the user receives.
---
## Cross-Harness and Translations
### Skill subsets (Codex and Cursor)
ECC ships skill subsets for other harnesses:
- **Codex:** `.agents/skills/` — skills listed in `agents/openai.yaml` are loaded by Codex.
- **Cursor:** `.cursor/skills/` — a subset of skills is bundled for Cursor.
When you **add a new skill** that should be available on Codex or Cursor:
1. Add the skill under `skills/your-skill-name/` as usual.
2. If it should be available on **Codex**, add it to `.agents/skills/` (copy the skill directory or add a reference) and ensure it is referenced in `agents/openai.yaml` if required.
3. If it should be available on **Cursor**, add it under `.cursor/skills/` per Cursor's layout.
Check existing skills in those directories for the expected structure. Keeping these subsets in sync is manual; mention in your PR if you updated them.
### Translations
Translations live under `docs/` (e.g. `docs/zh-CN`, `docs/zh-TW`, `docs/ja-JP`). If you change agents, commands, or skills that are translated, consider updating the corresponding translation files or opening an issue so maintainers or translators can update them.
---
## Pull Request Process
### 1. PR Title Format

111
README.md
View File

@@ -14,9 +14,10 @@
![Python](https://img.shields.io/badge/-Python-3776AB?logo=python&logoColor=white)
![Go](https://img.shields.io/badge/-Go-00ADD8?logo=go&logoColor=white)
![Java](https://img.shields.io/badge/-Java-ED8B00?logo=openjdk&logoColor=white)
![Perl](https://img.shields.io/badge/-Perl-39457E?logo=perl&logoColor=white)
![Markdown](https://img.shields.io/badge/-Markdown-000000?logo=markdown&logoColor=white)
> **50K+ stars** | **6K+ forks** | **30 contributors** | **6 languages supported** | **Anthropic Hackathon Winner**
> **50K+ stars** | **6K+ forks** | **30 contributors** | **5 languages supported** | **Anthropic Hackathon Winner**
---
@@ -38,24 +39,6 @@ Works across **Claude Code**, **Codex**, **Cowork**, and other AI agent harnesse
---
## Traction & Distribution
Use these live signals when presenting ECC to sponsors, platforms, or ecosystem partners:
- **Main package installs:** [`ecc-universal` on npm](https://www.npmjs.com/package/ecc-universal)
- **Security companion installs:** [`ecc-agentshield` on npm](https://www.npmjs.com/package/ecc-agentshield)
- **GitHub App distribution:** [ECC Tools marketplace listing](https://github.com/marketplace/ecc-tools)
- **Automated monthly metrics issue:** powered by `.github/workflows/monthly-metrics.yml`
- **Repo adoption signal:** stars/forks/contributors badges at the top of this README
Download counts for Claude Code plugin installs are not currently exposed as a public API. For partner reporting, combine npm metrics with GitHub App installs and repository traffic/fork growth.
For a sponsor-call metrics checklist and command snippets, see [`docs/business/metrics-and-sponsorship.md`](docs/business/metrics-and-sponsorship.md).
[**Sponsor ECC**](https://github.com/sponsors/affaan-m) | [Sponsor Tiers](SPONSORS.md) | [Sponsorship Program](SPONSORING.md)
---
## The Guides
This repo is the raw code only. The guides explain everything.
@@ -173,9 +156,9 @@ git clone https://github.com/affaan-m/everything-claude-code.git
cd everything-claude-code
# Recommended: use the installer (handles common + language rules safely)
./install.sh typescript # or python or golang
./install.sh typescript # or python or golang or swift or php
# You can pass multiple languages:
# ./install.sh typescript python golang
# ./install.sh typescript python golang swift php
# or target cursor:
# ./install.sh --target cursor typescript
# or target antigravity:
@@ -292,6 +275,7 @@ everything-claude-code/
| |-- security-review/ # Security checklist
| |-- eval-harness/ # Verification loop evaluation (Longform Guide)
| |-- verification-loop/ # Continuous verification (Longform Guide)
| |-- videodb/ # Video and audio: ingest, search, edit, generate, stream (NEW)
| |-- golang-patterns/ # Go idioms and best practices
| |-- golang-testing/ # Go testing patterns, TDD, benchmarks
| |-- cpp-coding-standards/ # C++ coding standards from C++ Core Guidelines (NEW)
@@ -328,6 +312,9 @@ everything-claude-code/
| |-- liquid-glass-design/ # iOS 26 Liquid Glass design system (NEW)
| |-- foundation-models-on-device/ # Apple on-device LLM with FoundationModels (NEW)
| |-- swift-concurrency-6-2/ # Swift 6.2 Approachable Concurrency (NEW)
| |-- perl-patterns/ # Modern Perl 5.36+ idioms and best practices (NEW)
| |-- perl-security/ # Perl security patterns, taint mode, safe I/O (NEW)
| |-- perl-testing/ # Perl TDD with Test2::V0, prove, Devel::Cover (NEW)
| |-- autonomous-loops/ # Autonomous loop patterns: sequential pipelines, PR loops, DAG orchestration (NEW)
| |-- plankton-code-quality/ # Write-time code quality enforcement with Plankton hooks (NEW)
|
@@ -379,6 +366,8 @@ everything-claude-code/
| |-- typescript/ # TypeScript/JavaScript specific
| |-- python/ # Python specific
| |-- golang/ # Go specific
| |-- swift/ # Swift specific
| |-- php/ # PHP specific (NEW)
|
|-- hooks/ # Trigger-based automations
| |-- README.md # Hook documentation, recipes, and customization guide
@@ -581,6 +570,7 @@ This gives you instant access to all commands, agents, skills, and hooks.
> cp -r everything-claude-code/rules/typescript/* ~/.claude/rules/ # pick your stack
> cp -r everything-claude-code/rules/python/* ~/.claude/rules/
> cp -r everything-claude-code/rules/golang/* ~/.claude/rules/
> cp -r everything-claude-code/rules/php/* ~/.claude/rules/
>
> # Option B: Project-level rules (applies to current project only)
> mkdir -p .claude/rules
@@ -606,6 +596,7 @@ cp -r everything-claude-code/rules/common/* ~/.claude/rules/
cp -r everything-claude-code/rules/typescript/* ~/.claude/rules/ # pick your stack
cp -r everything-claude-code/rules/python/* ~/.claude/rules/
cp -r everything-claude-code/rules/golang/* ~/.claude/rules/
cp -r everything-claude-code/rules/php/* ~/.claude/rules/
# Copy commands
cp everything-claude-code/commands/*.md ~/.claude/commands/
@@ -688,6 +679,8 @@ rules/
typescript/ # TS/JS specific patterns and tools
python/ # Python specific patterns and tools
golang/ # Go specific patterns and tools
swift/ # Swift specific patterns and tools
php/ # PHP specific patterns and tools
```
See [`rules/README.md`](rules/README.md) for installation and structure details.
@@ -757,6 +750,31 @@ This shows all available agents, commands, and skills from the plugin.
This is the most common issue. **Do NOT add a `"hooks"` field to `.claude-plugin/plugin.json`.** Claude Code v2.1+ automatically loads `hooks/hooks.json` from installed plugins. Explicitly declaring it causes duplicate detection errors. See [#29](https://github.com/affaan-m/everything-claude-code/issues/29), [#52](https://github.com/affaan-m/everything-claude-code/issues/52), [#103](https://github.com/affaan-m/everything-claude-code/issues/103).
</details>
<details>
<summary><b>Can I use ECC with Claude Code on a custom API endpoint or model gateway?</b></summary>
Yes. ECC does not hardcode Anthropic-hosted transport settings. It runs locally through Claude Code's normal CLI/plugin surface, so it works with:
- Anthropic-hosted Claude Code
- Official Claude Code gateway setups using `ANTHROPIC_BASE_URL` and `ANTHROPIC_AUTH_TOKEN`
- Compatible custom endpoints that speak the Anthropic API Claude Code expects
Minimal example:
```bash
export ANTHROPIC_BASE_URL=https://your-gateway.example.com
export ANTHROPIC_AUTH_TOKEN=your-token
claude
```
If your gateway remaps model names, configure that in Claude Code rather than in ECC. ECC's hooks, skills, commands, and rules are model-provider agnostic once the `claude` CLI is already working.
Official references:
- [Claude Code LLM gateway docs](https://docs.anthropic.com/en/docs/claude-code/llm-gateway)
- [Claude Code model configuration docs](https://docs.anthropic.com/en/docs/claude-code/model-config)
</details>
<details>
<summary><b>My context window is shrinking / Claude is running out of context</b></summary>
@@ -842,7 +860,7 @@ Please contribute! See [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.
### Ideas for Contributions
- Language-specific skills (Rust, C#, Swift, Kotlin) — Go, Python, Java already included
- Language-specific skills (Rust, C#, Kotlin, Java) — Go, Python, Perl, Swift, and TypeScript already included
- Framework-specific configs (Rails, Laravel, FastAPI, NestJS) — Django, Spring Boot already included
- DevOps agents (Kubernetes, Terraform, AWS, Docker)
- Testing strategies (different frameworks, visual regression)
@@ -859,7 +877,7 @@ ECC provides **full Cursor IDE support** with hooks, rules, agents, skills, comm
```bash
# Install for your language(s)
./install.sh --target cursor typescript
./install.sh --target cursor python golang swift
./install.sh --target cursor python golang swift php
```
### What's Included
@@ -868,7 +886,7 @@ ECC provides **full Cursor IDE support** with hooks, rules, agents, skills, comm
|-----------|-------|---------|
| Hook Events | 15 | sessionStart, beforeShellExecution, afterFileEdit, beforeMCPExecution, beforeSubmitPrompt, and 10 more |
| Hook Scripts | 16 | Thin Node.js scripts delegating to `scripts/hooks/` via shared adapter |
| Rules | 29 | 9 common (alwaysApply) + 20 language-specific (TypeScript, Python, Go, Swift) |
| Rules | 34 | 9 common (alwaysApply) + 25 language-specific (TypeScript, Python, Go, Swift, PHP) |
| Agents | Shared | Via AGENTS.md at root (read by Cursor natively) |
| Skills | Shared + Bundled | Via AGENTS.md at root and `.cursor/skills/` for translated additions |
| Commands | Shared | `.cursor/commands/` if installed |
@@ -911,27 +929,30 @@ ECC provides **first-class Codex support** for both the macOS app and CLI, with
### Quick Start (Codex App + CLI)
```bash
# Copy the reference config to your home directory
cp .codex/config.toml ~/.codex/config.toml
# Run Codex CLI in the repo — AGENTS.md is auto-detected
# Run Codex CLI in the repo — AGENTS.md and .codex/ are auto-detected
codex
# Optional: copy the global-safe defaults to your home directory
cp .codex/config.toml ~/.codex/config.toml
```
Codex macOS app:
- Open this repository as your workspace.
- The root `AGENTS.md` is auto-detected.
- Optional: copy `.codex/config.toml` to `~/.codex/config.toml` for CLI/app behavior consistency.
- `.codex/config.toml` and `.codex/agents/*.toml` work best when kept project-local.
- The reference `.codex/config.toml` intentionally does not pin `model` or `model_provider`, so Codex uses its own current default unless you override it.
- Optional: copy `.codex/config.toml` to `~/.codex/config.toml` for global defaults; keep the multi-agent role files project-local unless you also copy `.codex/agents/`.
### What's Included
| Component | Count | Details |
|-----------|-------|---------|
| Config | 1 | `.codex/config.toml`model, permissions, MCP servers, persistent instructions |
| Config | 1 | `.codex/config.toml`top-level approvals/sandbox/web_search, MCP servers, notifications, profiles |
| AGENTS.md | 2 | Root (universal) + `.codex/AGENTS.md` (Codex-specific supplement) |
| Skills | 16 | `.agents/skills/` — SKILL.md + agents/openai.yaml per skill |
| MCP Servers | 4 | GitHub, Context7, Memory, Sequential Thinking (command-based) |
| Profiles | 2 | `strict` (read-only sandbox) and `yolo` (full auto-approve) |
| Agent Roles | 3 | `.codex/agents/` — explorer, reviewer, docs-researcher |
### Skills
@@ -958,7 +979,24 @@ Skills at `.agents/skills/` are auto-loaded by Codex:
### Key Limitation
Codex does **not yet provide Claude-style hook execution parity**. ECC enforcement there is instruction-based via `AGENTS.md` and `persistent_instructions`, plus sandbox permissions.
Codex does **not yet provide Claude-style hook execution parity**. ECC enforcement there is instruction-based via `AGENTS.md`, optional `model_instructions_file` overrides, and sandbox/approval settings.
### Multi-Agent Support
Current Codex builds support experimental multi-agent workflows.
- Enable `features.multi_agent = true` in `.codex/config.toml`
- Define roles under `[agents.<name>]`
- Point each role at a file under `.codex/agents/`
- Use `/agent` in the CLI to inspect or steer child agents
ECC ships three sample role configs:
| Role | Purpose |
|------|---------|
| `explorer` | Read-only codebase evidence gathering before edits |
| `reviewer` | Correctness, security, and missing-test review |
| `docs_researcher` | Documentation and API verification before release/docs changes |
---
@@ -1068,6 +1106,13 @@ Then add to your `opencode.json`:
}
```
That npm plugin entry enables ECC's published OpenCode plugin module (hooks/events and plugin tools).
It does **not** automatically add ECC's full command/agent/instruction catalog to your project config.
For the full ECC OpenCode setup, either:
- run OpenCode inside this repository, or
- copy the bundled `.opencode/` config assets into your project and wire the `instructions`, `agent`, and `command` entries in `opencode.json`
### Documentation
- **Migration Guide**: `.opencode/MIGRATION.md`
@@ -1088,7 +1133,7 @@ ECC is the **first plugin to maximize every major AI coding tool**. Here's how e
| **Skills** | 65 | Shared | 10 (native format) | 37 |
| **Hook Events** | 8 types | 15 types | None yet | 11 types |
| **Hook Scripts** | 20+ scripts | 16 scripts (DRY adapter) | N/A | Plugin hooks |
| **Rules** | 29 (common + lang) | 29 (YAML frontmatter) | Instruction-based | 13 instructions |
| **Rules** | 34 (common + lang) | 34 (YAML frontmatter) | Instruction-based | 13 instructions |
| **Custom Tools** | Via hooks | Via hooks | N/A | 6 native tools |
| **MCP Servers** | 14 | Shared (mcp.json) | 4 (command-based) | Full |
| **Config Format** | settings.json | hooks.json + rules/ | config.toml | opencode.json |
@@ -1101,7 +1146,7 @@ ECC is the **first plugin to maximize every major AI coding tool**. Here's how e
- **AGENTS.md** at root is the universal cross-tool file (read by all 4 tools)
- **DRY adapter pattern** lets Cursor reuse Claude Code's hook scripts without duplication
- **Skills format** (SKILL.md with YAML frontmatter) works across Claude Code, Codex, and OpenCode
- Codex's lack of hooks is compensated by `persistent_instructions` and sandbox permissions
- Codex's lack of hooks is compensated by `AGENTS.md`, optional `model_instructions_file` overrides, and sandbox permissions
---

View File

@@ -5,6 +5,7 @@
![Shell](https://img.shields.io/badge/-Shell-4EAA25?logo=gnu-bash&logoColor=white)
![TypeScript](https://img.shields.io/badge/-TypeScript-3178C6?logo=typescript&logoColor=white)
![Go](https://img.shields.io/badge/-Go-00ADD8?logo=go&logoColor=white)
![Perl](https://img.shields.io/badge/-Perl-39457E?logo=perl&logoColor=white)
![Markdown](https://img.shields.io/badge/-Markdown-000000?logo=markdown&logoColor=white)
---
@@ -81,8 +82,12 @@
# 首先克隆仓库
git clone https://github.com/affaan-m/everything-claude-code.git
# 复制规则(应用于所有项目
cp -r everything-claude-code/rules/* ~/.claude/rules/
# 复制规则(通用 + 语言特定
cp -r everything-claude-code/rules/common/* ~/.claude/rules/
cp -r everything-claude-code/rules/typescript/* ~/.claude/rules/ # 选择你的技术栈
cp -r everything-claude-code/rules/python/* ~/.claude/rules/
cp -r everything-claude-code/rules/golang/* ~/.claude/rules/
cp -r everything-claude-code/rules/perl/* ~/.claude/rules/
```
### 第三步:开始使用
@@ -175,6 +180,9 @@ everything-claude-code/
| |-- golang-patterns/ # Go 惯用语和最佳实践(新增)
| |-- golang-testing/ # Go 测试模式、TDD、基准测试新增
| |-- cpp-testing/ # C++ 测试模式、GoogleTest、CMake/CTest新增
| |-- perl-patterns/ # 现代 Perl 5.36+ 惯用语和最佳实践(新增)
| |-- perl-security/ # Perl 安全模式、污染模式、安全 I/O新增
| |-- perl-testing/ # 使用 Test2::V0、prove、Devel::Cover 的 Perl TDD新增
|
|-- commands/ # 用于快速执行的斜杠命令
| |-- tdd.md # /tdd - 测试驱动开发
@@ -197,12 +205,20 @@ everything-claude-code/
| |-- evolve.md # /evolve - 将直觉聚类到技能中(新增)
|
|-- rules/ # 始终遵循的指南(复制到 ~/.claude/rules/
| |-- security.md # 强制性安全检查
| |-- coding-style.md # 不可变性、文件组织
| |-- testing.md # TDD、80% 覆盖率要求
| |-- git-workflow.md # 提交格式、PR 流程
| |-- agents.md # 何时委托给子代理
| |-- performance.md # 模型选择、上下文管理
| |-- README.md # 结构概述和安装指南
| |-- common/ # 与语言无关的原则
| | |-- coding-style.md # 不可变性、文件组织
| | |-- git-workflow.md # 提交格式、PR 流程
| | |-- testing.md # TDD、80% 覆盖率要求
| | |-- performance.md # 模型选择、上下文管理
| | |-- patterns.md # 设计模式、骨架项目
| | |-- hooks.md # 钩子架构、TodoWrite
| | |-- agents.md # 何时委托给子代理
| | |-- security.md # 强制性安全检查
| |-- typescript/ # TypeScript/JavaScript 特定
| |-- python/ # Python 特定
| |-- golang/ # Go 特定
| |-- perl/ # Perl 特定(新增)
|
|-- hooks/ # 基于触发器的自动化
| |-- hooks.json # 所有钩子配置PreToolUse、PostToolUse、Stop 等)
@@ -356,8 +372,12 @@ git clone https://github.com/affaan-m/everything-claude-code.git
# 将代理复制到你的 Claude 配置
cp everything-claude-code/agents/*.md ~/.claude/agents/
# 复制规则
cp everything-claude-code/rules/*.md ~/.claude/rules/
# 复制规则(通用 + 语言特定)
cp -r everything-claude-code/rules/common/* ~/.claude/rules/
cp -r everything-claude-code/rules/typescript/* ~/.claude/rules/ # 选择你的技术栈
cp -r everything-claude-code/rules/python/* ~/.claude/rules/
cp -r everything-claude-code/rules/golang/* ~/.claude/rules/
cp -r everything-claude-code/rules/perl/* ~/.claude/rules/
# 复制命令
cp everything-claude-code/commands/*.md ~/.claude/commands/
@@ -425,13 +445,15 @@ model: opus
### 规则
规则是始终遵循的指南。保持模块化
规则是始终遵循的指南,分为 `common/`(通用)+ 语言特定目录
```
~/.claude/rules/
security.md # 无硬编码秘密
coding-style.md # 不可变性、文件限制
testing.md # TDD、覆盖率要求
common/ # 通用原则(必装)
typescript/ # TS/JS 特定模式和工具
python/ # Python 特定模式和工具
golang/ # Go 特定模式和工具
perl/ # Perl 特定模式和工具
```
---
@@ -466,7 +488,7 @@ node tests/hooks/hooks.test.js
### 贡献想法
- 特定语言的技能(Python、Rust 模式)- 现已包含 Go
- 特定语言的技能(Rust、C#、Kotlin、Java- 现已包含 Go、Python、Perl、Swift 和 TypeScript
- 特定框架的配置Django、Rails、Laravel
- DevOps 代理Kubernetes、Terraform、AWS
- 测试策略(不同框架)

422
TROUBLESHOOTING.md Normal file
View File

@@ -0,0 +1,422 @@
# Troubleshooting Guide
Common issues and solutions for Everything Claude Code (ECC) plugin.
## Table of Contents
- [Memory & Context Issues](#memory--context-issues)
- [Agent Harness Failures](#agent-harness-failures)
- [Hook & Workflow Errors](#hook--workflow-errors)
- [Installation & Setup](#installation--setup)
- [Performance Issues](#performance-issues)
- [Common Error Messages](#common-error-messages)
- [Getting Help](#getting-help)
---
## Memory & Context Issues
### Context Window Overflow
**Symptom:** "Context too long" errors or incomplete responses
**Causes:**
- Large file uploads exceeding token limits
- Accumulated conversation history
- Multiple large tool outputs in single session
**Solutions:**
```bash
# 1. Clear conversation history and start fresh
# Use Claude Code: "New Chat" or Cmd/Ctrl+Shift+N
# 2. Reduce file size before analysis
head -n 100 large-file.log > sample.log
# 3. Use streaming for large outputs
head -n 50 large-file.txt
# 4. Split tasks into smaller chunks
# Instead of: "Analyze all 50 files"
# Use: "Analyze files in src/components/ directory"
```
### Memory Persistence Failures
**Symptom:** Agent doesn't remember previous context or observations
**Causes:**
- Disabled continuous-learning hooks
- Corrupted observation files
- Project detection failures
**Solutions:**
```bash
# Check if observations are being recorded
ls ~/.claude/homunculus/projects/*/observations.jsonl
# Find the current project's hash id
python3 - <<'PY'
import json, os
registry_path = os.path.expanduser("~/.claude/homunculus/projects.json")
with open(registry_path) as f:
registry = json.load(f)
for project_id, meta in registry.items():
if meta.get("root") == os.getcwd():
print(project_id)
break
else:
raise SystemExit("Project hash not found in ~/.claude/homunculus/projects.json")
PY
# View recent observations for that project
tail -20 ~/.claude/homunculus/projects/<project-hash>/observations.jsonl
# Back up a corrupted observations file before recreating it
mv ~/.claude/homunculus/projects/<project-hash>/observations.jsonl \
~/.claude/homunculus/projects/<project-hash>/observations.jsonl.bak.$(date +%Y%m%d-%H%M%S)
# Verify hooks are enabled
grep -r "observe" ~/.claude/settings.json
```
---
## Agent Harness Failures
### Agent Not Found
**Symptom:** "Agent not loaded" or "Unknown agent" errors
**Causes:**
- Plugin not installed correctly
- Agent path misconfiguration
- Marketplace vs manual install mismatch
**Solutions:**
```bash
# Check plugin installation
ls ~/.claude/plugins/cache/
# Verify agent exists (marketplace install)
ls ~/.claude/plugins/cache/*/agents/
# For manual install, agents should be in:
ls ~/.claude/agents/ # Custom agents only
# Reload plugin
# Claude Code → Settings → Extensions → Reload
```
### Workflow Execution Hangs
**Symptom:** Agent starts but never completes
**Causes:**
- Infinite loops in agent logic
- Blocked on user input
- Network timeout waiting for API
**Solutions:**
```bash
# 1. Check for stuck processes
ps aux | grep claude
# 2. Enable debug mode
export CLAUDE_DEBUG=1
# 3. Set shorter timeouts
export CLAUDE_TIMEOUT=30
# 4. Check network connectivity
curl -I https://api.anthropic.com
```
### Tool Use Errors
**Symptom:** "Tool execution failed" or permission denied
**Causes:**
- Missing dependencies (npm, python, etc.)
- Insufficient file permissions
- Path not found
**Solutions:**
```bash
# Verify required tools are installed
which node python3 npm git
# Fix permissions on hook scripts
chmod +x ~/.claude/plugins/cache/*/hooks/*.sh
chmod +x ~/.claude/plugins/cache/*/skills/*/hooks/*.sh
# Check PATH includes necessary binaries
echo $PATH
```
---
## Hook & Workflow Errors
### Hooks Not Firing
**Symptom:** Pre/post hooks don't execute
**Causes:**
- Hooks not registered in settings.json
- Invalid hook syntax
- Hook script not executable
**Solutions:**
```bash
# Check hooks are registered
grep -A 10 '"hooks"' ~/.claude/settings.json
# Verify hook files exist and are executable
ls -la ~/.claude/plugins/cache/*/hooks/
# Test hook manually
bash ~/.claude/plugins/cache/*/hooks/pre-bash.sh <<< '{"command":"echo test"}'
# Re-register hooks (if using plugin)
# Disable and re-enable plugin in Claude Code settings
```
### Python/Node Version Mismatches
**Symptom:** "python3 not found" or "node: command not found"
**Causes:**
- Missing Python/Node installation
- PATH not configured
- Wrong Python version (Windows)
**Solutions:**
```bash
# Install Python 3 (if missing)
# macOS: brew install python3
# Ubuntu: sudo apt install python3
# Windows: Download from python.org
# Install Node.js (if missing)
# macOS: brew install node
# Ubuntu: sudo apt install nodejs npm
# Windows: Download from nodejs.org
# Verify installations
python3 --version
node --version
npm --version
# Windows: Ensure python (not python3) works
python --version
```
### Dev Server Blocker False Positives
**Symptom:** Hook blocks legitimate commands mentioning "dev"
**Causes:**
- Heredoc content triggering pattern match
- Non-dev commands with "dev" in arguments
**Solutions:**
```bash
# This is fixed in v1.8.0+ (PR #371)
# Upgrade plugin to latest version
# Workaround: Wrap dev servers in tmux
tmux new-session -d -s dev "npm run dev"
tmux attach -t dev
# Disable hook temporarily if needed
# Edit ~/.claude/settings.json and remove pre-bash hook
```
---
## Installation & Setup
### Plugin Not Loading
**Symptom:** Plugin features unavailable after install
**Causes:**
- Marketplace cache not updated
- Claude Code version incompatibility
- Corrupted plugin files
**Solutions:**
```bash
# Inspect the plugin cache before changing it
ls -la ~/.claude/plugins/cache/
# Back up the plugin cache instead of deleting it in place
mv ~/.claude/plugins/cache ~/.claude/plugins/cache.backup.$(date +%Y%m%d-%H%M%S)
mkdir -p ~/.claude/plugins/cache
# Reinstall from marketplace
# Claude Code → Extensions → Everything Claude Code → Uninstall
# Then reinstall from marketplace
# Check Claude Code version
claude --version
# Requires Claude Code 2.0+
# Manual install (if marketplace fails)
git clone https://github.com/affaan-m/everything-claude-code.git
cp -r everything-claude-code ~/.claude/plugins/ecc
```
### Package Manager Detection Fails
**Symptom:** Wrong package manager used (npm instead of pnpm)
**Causes:**
- No lock file present
- CLAUDE_PACKAGE_MANAGER not set
- Multiple lock files confusing detection
**Solutions:**
```bash
# Set preferred package manager globally
export CLAUDE_PACKAGE_MANAGER=pnpm
# Add to ~/.bashrc or ~/.zshrc
# Or set per-project
echo '{"packageManager": "pnpm"}' > .claude/package-manager.json
# Or use package.json field
npm pkg set packageManager="pnpm@8.15.0"
# Warning: removing lock files can change installed dependency versions.
# Commit or back up the lock file first, then run a fresh install and re-run CI.
# Only do this when intentionally switching package managers.
rm package-lock.json # If using pnpm/yarn/bun
```
---
## Performance Issues
### Slow Response Times
**Symptom:** Agent takes 30+ seconds to respond
**Causes:**
- Large observation files
- Too many active hooks
- Network latency to API
**Solutions:**
```bash
# Archive large observations instead of deleting them
archive_dir="$HOME/.claude/homunculus/archive/$(date +%Y%m%d)"
mkdir -p "$archive_dir"
find ~/.claude/homunculus/projects -name "observations.jsonl" -size +10M -exec sh -c '
for file do
base=$(basename "$(dirname "$file")")
gzip -c "$file" > "'"$archive_dir"'/${base}-observations.jsonl.gz"
: > "$file"
done
' sh {} +
# Disable unused hooks temporarily
# Edit ~/.claude/settings.json
# Keep active observation files small
# Large archives should live under ~/.claude/homunculus/archive/
```
### High CPU Usage
**Symptom:** Claude Code consuming 100% CPU
**Causes:**
- Infinite observation loops
- File watching on large directories
- Memory leaks in hooks
**Solutions:**
```bash
# Check for runaway processes
top -o cpu | grep claude
# Disable continuous learning temporarily
touch ~/.claude/homunculus/disabled
# Restart Claude Code
# Cmd/Ctrl+Q then reopen
# Check observation file size
du -sh ~/.claude/homunculus/*/
```
---
## Common Error Messages
### "EACCES: permission denied"
```bash
# Fix hook permissions
find ~/.claude/plugins -name "*.sh" -exec chmod +x {} \;
# Fix observation directory permissions
chmod -R u+rwX,go+rX ~/.claude/homunculus
```
### "MODULE_NOT_FOUND"
```bash
# Install plugin dependencies
cd ~/.claude/plugins/cache/everything-claude-code
npm install
# Or for manual install
cd ~/.claude/plugins/ecc
npm install
```
### "spawn UNKNOWN"
```bash
# Windows-specific: Ensure scripts use correct line endings
# Convert CRLF to LF
find ~/.claude/plugins -name "*.sh" -exec dos2unix {} \;
# Or install dos2unix
# macOS: brew install dos2unix
# Ubuntu: sudo apt install dos2unix
```
---
## Getting Help
If you're still experiencing issues:
1. **Check GitHub Issues**: [github.com/affaan-m/everything-claude-code/issues](https://github.com/affaan-m/everything-claude-code/issues)
2. **Enable Debug Logging**:
```bash
export CLAUDE_DEBUG=1
export CLAUDE_LOG_LEVEL=debug
```
3. **Collect Diagnostic Info**:
```bash
claude --version
node --version
python3 --version
echo $CLAUDE_PACKAGE_MANAGER
ls -la ~/.claude/plugins/cache/
```
4. **Open an Issue**: Include debug logs, error messages, and diagnostic info
---
## Related Documentation
- [README.md](./README.md) - Installation and features
- [CONTRIBUTING.md](./CONTRIBUTING.md) - Development guidelines
- [docs/](./docs/) - Detailed documentation
- [examples/](./examples/) - Usage examples

159
agents/kotlin-reviewer.md Normal file
View File

@@ -0,0 +1,159 @@
---
name: kotlin-reviewer
description: Kotlin and Android/KMP code reviewer. Reviews Kotlin code for idiomatic patterns, coroutine safety, Compose best practices, clean architecture violations, and common Android pitfalls.
tools: ["Read", "Grep", "Glob", "Bash"]
model: sonnet
---
You are a senior Kotlin and Android/KMP code reviewer ensuring idiomatic, safe, and maintainable code.
## Your Role
- Review Kotlin code for idiomatic patterns and Android/KMP best practices
- Detect coroutine misuse, Flow anti-patterns, and lifecycle bugs
- Enforce clean architecture module boundaries
- Identify Compose performance issues and recomposition traps
- You DO NOT refactor or rewrite code — you report findings only
## Workflow
### Step 1: Gather Context
Run `git diff --staged` and `git diff` to see changes. If no diff, check `git log --oneline -5`. Identify Kotlin/KTS files that changed.
### Step 2: Understand Project Structure
Check for:
- `build.gradle.kts` or `settings.gradle.kts` to understand module layout
- `CLAUDE.md` for project-specific conventions
- Whether this is Android-only, KMP, or Compose Multiplatform
### Step 2b: Security Review
Apply the Kotlin/Android security guidance before continuing:
- exported Android components, deep links, and intent filters
- insecure crypto, WebView, and network configuration usage
- keystore, token, and credential handling
- platform-specific storage and permission risks
If you find a CRITICAL security issue, stop the review and hand off to `security-reviewer` before doing any further analysis.
### Step 3: Read and Review
Read changed files fully. Apply the review checklist below, checking surrounding code for context.
### Step 4: Report Findings
Use the output format below. Only report issues with >80% confidence.
## Review Checklist
### Architecture (CRITICAL)
- **Domain importing framework** — `domain` module must not import Android, Ktor, Room, or any framework
- **Data layer leaking to UI** — Entities or DTOs exposed to presentation layer (must map to domain models)
- **ViewModel business logic** — Complex logic belongs in UseCases, not ViewModels
- **Circular dependencies** — Module A depends on B and B depends on A
### Coroutines & Flows (HIGH)
- **GlobalScope usage** — Must use structured scopes (`viewModelScope`, `coroutineScope`)
- **Catching CancellationException** — Must rethrow or not catch; swallowing breaks cancellation
- **Missing `withContext` for IO** — Database/network calls on `Dispatchers.Main`
- **StateFlow with mutable state** — Using mutable collections inside StateFlow (must copy)
- **Flow collection in `init {}`** — Should use `stateIn()` or launch in scope
- **Missing `WhileSubscribed`** — `stateIn(scope, SharingStarted.Eagerly)` when `WhileSubscribed` is appropriate
```kotlin
// BAD — swallows cancellation
try { fetchData() } catch (e: Exception) { log(e) }
// GOOD — preserves cancellation
try { fetchData() } catch (e: CancellationException) { throw e } catch (e: Exception) { log(e) }
// or use runCatching and check
```
### Compose (HIGH)
- **Unstable parameters** — Composables receiving mutable types cause unnecessary recomposition
- **Side effects outside LaunchedEffect** — Network/DB calls must be in `LaunchedEffect` or ViewModel
- **NavController passed deep** — Pass lambdas instead of `NavController` references
- **Missing `key()` in LazyColumn** — Items without stable keys cause poor performance
- **`remember` with missing keys** — Computation not recalculated when dependencies change
- **Object allocation in parameters** — Creating objects inline causes recomposition
```kotlin
// BAD — new lambda every recomposition
Button(onClick = { viewModel.doThing(item.id) })
// GOOD — stable reference
val onClick = remember(item.id) { { viewModel.doThing(item.id) } }
Button(onClick = onClick)
```
### Kotlin Idioms (MEDIUM)
- **`!!` usage** — Non-null assertion; prefer `?.`, `?:`, `requireNotNull`, or `checkNotNull`
- **`var` where `val` works** — Prefer immutability
- **Java-style patterns** — Static utility classes (use top-level functions), getters/setters (use properties)
- **String concatenation** — Use string templates `"Hello $name"` instead of `"Hello " + name`
- **`when` without exhaustive branches** — Sealed classes/interfaces should use exhaustive `when`
- **Mutable collections exposed** — Return `List` not `MutableList` from public APIs
### Android Specific (MEDIUM)
- **Context leaks** — Storing `Activity` or `Fragment` references in singletons/ViewModels
- **Missing ProGuard rules** — Serialized classes without `@Keep` or ProGuard rules
- **Hardcoded strings** — User-facing strings not in `strings.xml` or Compose resources
- **Missing lifecycle handling** — Collecting Flows in Activities without `repeatOnLifecycle`
### Security (CRITICAL)
- **Exported component exposure** — Activities, services, or receivers exported without proper guards
- **Insecure crypto/storage** — Homegrown crypto, plaintext secrets, or weak keystore usage
- **Unsafe WebView/network config** — JavaScript bridges, cleartext traffic, permissive trust settings
- **Sensitive logging** — Tokens, credentials, PII, or secrets emitted to logs
If any CRITICAL security issue is present, stop and escalate to `security-reviewer`.
### Gradle & Build (LOW)
- **Version catalog not used** — Hardcoded versions instead of `libs.versions.toml`
- **Unnecessary dependencies** — Dependencies added but not used
- **Missing KMP source sets** — Declaring `androidMain` code that could be `commonMain`
## Output Format
```
[CRITICAL] Domain module imports Android framework
File: domain/src/main/kotlin/com/app/domain/UserUseCase.kt:3
Issue: `import android.content.Context` — domain must be pure Kotlin with no framework dependencies.
Fix: Move Context-dependent logic to data or platforms layer. Pass data via repository interface.
[HIGH] StateFlow holding mutable list
File: presentation/src/main/kotlin/com/app/ui/ListViewModel.kt:25
Issue: `_state.value.items.add(newItem)` mutates the list inside StateFlow — Compose won't detect the change.
Fix: Use `_state.update { it.copy(items = it.items + newItem) }`
```
## Summary Format
End every review with:
```
## Review Summary
| Severity | Count | Status |
|----------|-------|--------|
| CRITICAL | 0 | pass |
| HIGH | 1 | block |
| MEDIUM | 2 | info |
| LOW | 0 | note |
Verdict: BLOCK — HIGH issues must be fixed before merge.
```
## Approval Criteria
- **Approve**: No CRITICAL or HIGH issues
- **Block**: Any CRITICAL or HIGH issues — must fix before merge

View File

@@ -337,8 +337,10 @@ For PMX, prioritize these E2E tests:
## Related Agents
This command invokes the `e2e-runner` agent located at:
`~/.claude/agents/e2e-runner.md`
This command invokes the `e2e-runner` agent provided by ECC.
For manual installs, the source file lives at:
`agents/e2e-runner.md`
## Quick Commands

70
commands/gradle-build.md Normal file
View File

@@ -0,0 +1,70 @@
---
description: Fix Gradle build errors for Android and KMP projects
---
# Gradle Build Fix
Incrementally fix Gradle build and compilation errors for Android and Kotlin Multiplatform projects.
## Step 1: Detect Build Configuration
Identify the project type and run the appropriate build:
| Indicator | Build Command |
|-----------|---------------|
| `build.gradle.kts` + `composeApp/` (KMP) | `./gradlew composeApp:compileKotlinMetadata 2>&1` |
| `build.gradle.kts` + `app/` (Android) | `./gradlew app:compileDebugKotlin 2>&1` |
| `settings.gradle.kts` with modules | `./gradlew assemble 2>&1` |
| Detekt configured | `./gradlew detekt 2>&1` |
Also check `gradle.properties` and `local.properties` for configuration.
## Step 2: Parse and Group Errors
1. Run the build command and capture output
2. Separate Kotlin compilation errors from Gradle configuration errors
3. Group by module and file path
4. Sort: configuration errors first, then compilation errors by dependency order
## Step 3: Fix Loop
For each error:
1. **Read the file** — Full context around the error line
2. **Diagnose** — Common categories:
- Missing import or unresolved reference
- Type mismatch or incompatible types
- Missing dependency in `build.gradle.kts`
- Expect/actual mismatch (KMP)
- Compose compiler error
3. **Fix minimally** — Smallest change that resolves the error
4. **Re-run build** — Verify fix and check for new errors
5. **Continue** — Move to next error
## Step 4: Guardrails
Stop and ask the user if:
- Fix introduces more errors than it resolves
- Same error persists after 3 attempts
- Error requires adding new dependencies or changing module structure
- Gradle sync itself fails (configuration-phase error)
- Error is in generated code (Room, SQLDelight, KSP)
## Step 5: Summary
Report:
- Errors fixed (module, file, description)
- Errors remaining
- New errors introduced (should be zero)
- Suggested next steps
## Common Gradle/KMP Fixes
| Error | Fix |
|-------|-----|
| Unresolved reference in `commonMain` | Check if the dependency is in `commonMain.dependencies {}` |
| Expect declaration without actual | Add `actual` implementation in each platform source set |
| Compose compiler version mismatch | Align Kotlin and Compose compiler versions in `libs.versions.toml` |
| Duplicate class | Check for conflicting dependencies with `./gradlew dependencies` |
| KSP error | Run `./gradlew kspCommonMainKotlinMetadata` to regenerate |
| Configuration cache issue | Check for non-serializable task inputs |

View File

@@ -1,10 +1,10 @@
---
description: Extract reusable patterns from the session, self-evaluate quality before saving, and determine the right save location (Global vs Project).
description: "Extract reusable patterns from the session, self-evaluate quality before saving, and determine the right save location (Global vs Project)."
---
# /learn-eval - Extract, Evaluate, then Save
Extends `/learn` with a quality gate and save-location decision before writing any skill file.
Extends `/learn` with a quality gate, save-location decision, and knowledge-placement awareness before writing any skill file.
## What to Extract
@@ -51,36 +51,61 @@ origin: auto-extracted
[Trigger conditions]
```
5. **Self-evaluate before saving** using this rubric:
5. **Quality gate — Checklist + Holistic verdict**
| Dimension | 1 | 3 | 5 |
|-----------|---|---|---|
| Specificity | Abstract principles only, no code examples | Representative code example present | Rich examples covering all usage patterns |
| Actionability | Unclear what to do | Main steps are understandable | Immediately actionable, edge cases covered |
| Scope Fit | Too broad or too narrow | Mostly appropriate, some boundary ambiguity | Name, trigger, and content perfectly aligned |
| Non-redundancy | Nearly identical to another skill | Some overlap but unique perspective exists | Completely unique value |
| Coverage | Covers only a fraction of the target task | Main cases covered, common variants missing | Main cases, edge cases, and pitfalls covered |
### 5a. Required checklist (verify by actually reading files)
- Score each dimension 15
- If any dimension scores 12, improve the draft and re-score until all dimensions are ≥ 3
- Show the user the scores table and the final draft
Execute **all** of the following before evaluating the draft:
6. Ask user to confirm:
- Show: proposed save path + scores table + final draft
- Wait for explicit confirmation before writing
- [ ] Grep `~/.claude/skills/` and relevant project `.claude/skills/` files by keyword to check for content overlap
- [ ] Check MEMORY.md (both project and global) for overlap
- [ ] Consider whether appending to an existing skill would suffice
- [ ] Confirm this is a reusable pattern, not a one-off fix
7. Save to the determined location
### 5b. Holistic verdict
## Output Format for Step 5 (scores table)
Synthesize the checklist results and draft quality, then choose **one** of the following:
| Dimension | Score | Rationale |
|-----------|-------|-----------|
| Specificity | N/5 | ... |
| Actionability | N/5 | ... |
| Scope Fit | N/5 | ... |
| Non-redundancy | N/5 | ... |
| Coverage | N/5 | ... |
| **Total** | **N/25** | |
| Verdict | Meaning | Next Action |
|---------|---------|-------------|
| **Save** | Unique, specific, well-scoped | Proceed to Step 6 |
| **Improve then Save** | Valuable but needs refinement | List improvements → revise → re-evaluate (once) |
| **Absorb into [X]** | Should be appended to an existing skill | Show target skill and additions → Step 6 |
| **Drop** | Trivial, redundant, or too abstract | Explain reasoning and stop |
**Guideline dimensions** (informing the verdict, not scored):
- **Specificity & Actionability**: Contains code examples or commands that are immediately usable
- **Scope Fit**: Name, trigger conditions, and content are aligned and focused on a single pattern
- **Uniqueness**: Provides value not covered by existing skills (informed by checklist results)
- **Reusability**: Realistic trigger scenarios exist in future sessions
6. **Verdict-specific confirmation flow**
- **Improve then Save**: Present the required improvements + revised draft + updated checklist/verdict after one re-evaluation; if the revised verdict is **Save**, save after user confirmation, otherwise follow the new verdict
- **Save**: Present save path + checklist results + 1-line verdict rationale + full draft → save after user confirmation
- **Absorb into [X]**: Present target path + additions (diff format) + checklist results + verdict rationale → append after user confirmation
- **Drop**: Show checklist results + reasoning only (no confirmation needed)
7. Save / Absorb to the determined location
## Output Format for Step 5
```
### Checklist
- [x] skills/ grep: no overlap (or: overlap found → details)
- [x] MEMORY.md: no overlap (or: overlap found → details)
- [x] Existing skill append: new file appropriate (or: should append to [X])
- [x] Reusability: confirmed (or: one-off → Drop)
### Verdict: Save / Improve then Save / Absorb into [X] / Drop
**Rationale:** (1-2 sentences explaining the verdict)
```
## Design Rationale
This version replaces the previous 5-dimension numeric scoring rubric (Specificity, Actionability, Scope Fit, Non-redundancy, Coverage scored 1-5) with a checklist-based holistic verdict system. Modern frontier models (Opus 4.6+) have strong contextual judgment — forcing rich qualitative signals into numeric scores loses nuance and can produce misleading totals. The holistic approach lets the model weigh all factors naturally, producing more accurate save/drop decisions while the explicit checklist ensures no critical check is skipped.
## Notes
@@ -88,4 +113,4 @@ origin: auto-extracted
- Don't extract one-time issues (specific API outages, etc.)
- Focus on patterns that will save time in future sessions
- Keep skills focused — one pattern per skill
- If Coverage score is low, add related variants before saving
- When the verdict is Absorb, append to the existing skill rather than creating a new file

View File

@@ -109,5 +109,7 @@ After planning:
## Related Agents
This command invokes the `planner` agent located at:
`~/.claude/agents/planner.md`
This command invokes the `planner` agent provided by ECC.
For manual installs, the source file lives at:
`agents/planner.md`

155
commands/resume-session.md Normal file
View File

@@ -0,0 +1,155 @@
---
description: Load the most recent session file from ~/.claude/sessions/ and resume work with full context from where the last session ended.
---
# Resume Session Command
Load the last saved session state and orient fully before doing any work.
This command is the counterpart to `/save-session`.
## When to Use
- Starting a new session to continue work from a previous day
- After starting a fresh session due to context limits
- When handing off a session file from another source (just provide the file path)
- Any time you have a session file and want Claude to fully absorb it before proceeding
## Usage
```
/resume-session # loads most recent file in ~/.claude/sessions/
/resume-session 2024-01-15 # loads most recent session for that date
/resume-session ~/.claude/sessions/2024-01-15-session.tmp # loads a specific legacy-format file
/resume-session ~/.claude/sessions/2024-01-15-abc123de-session.tmp # loads a current short-id session file
```
## Process
### Step 1: Find the session file
If no argument provided:
1. Check `~/.claude/sessions/`
2. Pick the most recently modified `*-session.tmp` file
3. If the folder does not exist or has no matching files, tell the user:
```
No session files found in ~/.claude/sessions/
Run /save-session at the end of a session to create one.
```
Then stop.
If an argument is provided:
- If it looks like a date (`YYYY-MM-DD`), search `~/.claude/sessions/` for files matching
`YYYY-MM-DD-session.tmp` (legacy format) or `YYYY-MM-DD-<shortid>-session.tmp` (current format)
and load the most recently modified variant for that date
- If it looks like a file path, read that file directly
- If not found, report clearly and stop
### Step 2: Read the entire session file
Read the complete file. Do not summarize yet.
### Step 3: Confirm understanding
Respond with a structured briefing in this exact format:
```
SESSION LOADED: [actual resolved path to the file]
════════════════════════════════════════════════
PROJECT: [project name / topic from file]
WHAT WE'RE BUILDING:
[2-3 sentence summary in your own words]
CURRENT STATE:
✅ Working: [count] items confirmed
🔄 In Progress: [list files that are in progress]
🗒️ Not Started: [list planned but untouched]
WHAT NOT TO RETRY:
[list every failed approach with its reason — this is critical]
OPEN QUESTIONS / BLOCKERS:
[list any blockers or unanswered questions]
NEXT STEP:
[exact next step if defined in the file]
[if not defined: "No next step defined — recommend reviewing 'What Has NOT Been Tried Yet' together before starting"]
════════════════════════════════════════════════
Ready to continue. What would you like to do?
```
### Step 4: Wait for the user
Do NOT start working automatically. Do NOT touch any files. Wait for the user to say what to do next.
If the next step is clearly defined in the session file and the user says "continue" or "yes" or similar — proceed with that exact next step.
If no next step is defined — ask the user where to start, and optionally suggest an approach from the "What Has NOT Been Tried Yet" section.
---
## Edge Cases
**Multiple sessions for the same date** (`2024-01-15-session.tmp`, `2024-01-15-abc123de-session.tmp`):
Load the most recently modified matching file for that date, regardless of whether it uses the legacy no-id format or the current short-id format.
**Session file references files that no longer exist:**
Note this during the briefing — "⚠️ `path/to/file.ts` referenced in session but not found on disk."
**Session file is from more than 7 days ago:**
Note the gap — "⚠️ This session is from N days ago (threshold: 7 days). Things may have changed." — then proceed normally.
**User provides a file path directly (e.g., forwarded from a teammate):**
Read it and follow the same briefing process — the format is the same regardless of source.
**Session file is empty or malformed:**
Report: "Session file found but appears empty or unreadable. You may need to create a new one with /save-session."
---
## Example Output
```
SESSION LOADED: /Users/you/.claude/sessions/2024-01-15-abc123de-session.tmp
════════════════════════════════════════════════
PROJECT: my-app — JWT Authentication
WHAT WE'RE BUILDING:
User authentication with JWT tokens stored in httpOnly cookies.
Register and login endpoints are partially done. Route protection
via middleware hasn't been started yet.
CURRENT STATE:
✅ Working: 3 items (register endpoint, JWT generation, password hashing)
🔄 In Progress: app/api/auth/login/route.ts (token works, cookie not set yet)
🗒️ Not Started: middleware.ts, app/login/page.tsx
WHAT NOT TO RETRY:
❌ Next-Auth — conflicts with custom Prisma adapter, threw adapter error on every request
❌ localStorage for JWT — causes SSR hydration mismatch, incompatible with Next.js
OPEN QUESTIONS / BLOCKERS:
- Does cookies().set() work inside a Route Handler or only Server Actions?
NEXT STEP:
In app/api/auth/login/route.ts — set the JWT as an httpOnly cookie using
cookies().set('token', jwt, { httpOnly: true, secure: true, sameSite: 'strict' })
then test with Postman for a Set-Cookie header in the response.
════════════════════════════════════════════════
Ready to continue. What would you like to do?
```
---
## Notes
- Never modify the session file when loading it — it's a read-only historical record
- The briefing format is fixed — do not skip sections even if they are empty
- "What Not To Retry" must always be shown, even if it just says "None" — it's too important to miss
- After resuming, the user may want to run `/save-session` again at the end of the new session to create a new dated file

275
commands/save-session.md Normal file
View File

@@ -0,0 +1,275 @@
---
description: Save current session state to a dated file in ~/.claude/sessions/ so work can be resumed in a future session with full context.
---
# Save Session Command
Capture everything that happened in this session — what was built, what worked, what failed, what's left — and write it to a dated file so the next session can pick up exactly where this one left off.
## When to Use
- End of a work session before closing Claude Code
- Before hitting context limits (run this first, then start a fresh session)
- After solving a complex problem you want to remember
- Any time you need to hand off context to a future session
## Process
### Step 1: Gather context
Before writing the file, collect:
- Read all files modified during this session (use git diff or recall from conversation)
- Review what was discussed, attempted, and decided
- Note any errors encountered and how they were resolved (or not)
- Check current test/build status if relevant
### Step 2: Create the sessions folder if it doesn't exist
Create the canonical sessions folder in the user's Claude home directory:
```bash
mkdir -p ~/.claude/sessions
```
### Step 3: Write the session file
Create `~/.claude/sessions/YYYY-MM-DD-<short-id>-session.tmp`, using today's actual date and a short-id that satisfies the rules enforced by `SESSION_FILENAME_REGEX` in `session-manager.js`:
- Allowed characters: lowercase `a-z`, digits `0-9`, hyphens `-`
- Minimum length: 8 characters
- No uppercase letters, no underscores, no spaces
Valid examples: `abc123de`, `a1b2c3d4`, `frontend-worktree-1`
Invalid examples: `ABC123de` (uppercase), `short` (under 8 chars), `test_id1` (underscore)
Full valid filename example: `2024-01-15-abc123de-session.tmp`
The legacy filename `YYYY-MM-DD-session.tmp` is still valid, but new session files should prefer the short-id form to avoid same-day collisions.
### Step 4: Populate the file with all sections below
Write every section honestly. Do not skip sections — write "Nothing yet" or "N/A" if a section genuinely has no content. An incomplete file is worse than an honest empty section.
### Step 5: Show the file to the user
After writing, display the full contents and ask:
```
Session saved to [actual resolved path to the session file]
Does this look accurate? Anything to correct or add before we close?
```
Wait for confirmation. Make edits if requested.
---
## Session File Format
```markdown
# Session: YYYY-MM-DD
**Started:** [approximate time if known]
**Last Updated:** [current time]
**Project:** [project name or path]
**Topic:** [one-line summary of what this session was about]
---
## What We Are Building
[1-3 paragraphs describing the feature, bug fix, or task. Include enough
context that someone with zero memory of this session can understand the goal.
Include: what it does, why it's needed, how it fits into the larger system.]
---
## What WORKED (with evidence)
[List only things that are confirmed working. For each item include WHY you
know it works — test passed, ran in browser, Postman returned 200, etc.
Without evidence, move it to "Not Tried Yet" instead.]
- **[thing that works]** — confirmed by: [specific evidence]
- **[thing that works]** — confirmed by: [specific evidence]
If nothing is confirmed working yet: "Nothing confirmed working yet — all approaches still in progress or untested."
---
## What Did NOT Work (and why)
[This is the most important section. List every approach tried that failed.
For each failure write the EXACT reason so the next session doesn't retry it.
Be specific: "threw X error because Y" is useful. "didn't work" is not.]
- **[approach tried]** — failed because: [exact reason / error message]
- **[approach tried]** — failed because: [exact reason / error message]
If nothing failed: "No failed approaches yet."
---
## What Has NOT Been Tried Yet
[Approaches that seem promising but haven't been attempted. Ideas from the
conversation. Alternative solutions worth exploring. Be specific enough that
the next session knows exactly what to try.]
- [approach / idea]
- [approach / idea]
If nothing is queued: "No specific untried approaches identified."
---
## Current State of Files
[Every file touched this session. Be precise about what state each file is in.]
| File | Status | Notes |
| ----------------- | -------------- | -------------------------- |
| `path/to/file.ts` | ✅ Complete | [what it does] |
| `path/to/file.ts` | 🔄 In Progress | [what's done, what's left] |
| `path/to/file.ts` | ❌ Broken | [what's wrong] |
| `path/to/file.ts` | 🗒️ Not Started | [planned but not touched] |
If no files were touched: "No files modified this session."
---
## Decisions Made
[Architecture choices, tradeoffs accepted, approaches chosen and why.
These prevent the next session from relitigating settled decisions.]
- **[decision]** — reason: [why this was chosen over alternatives]
If no significant decisions: "No major decisions made this session."
---
## Blockers & Open Questions
[Anything unresolved that the next session needs to address or investigate.
Questions that came up but weren't answered. External dependencies waiting on.]
- [blocker / open question]
If none: "No active blockers."
---
## Exact Next Step
[If known: The single most important thing to do when resuming. Be precise
enough that resuming requires zero thinking about where to start.]
[If not known: "Next step not determined — review 'What Has NOT Been Tried Yet'
and 'Blockers' sections to decide on direction before starting."]
---
## Environment & Setup Notes
[Only fill this if relevant — commands needed to run the project, env vars
required, services that need to be running, etc. Skip if standard setup.]
[If none: omit this section entirely.]
```
---
## Example Output
```markdown
# Session: 2024-01-15
**Started:** ~2pm
**Last Updated:** 5:30pm
**Project:** my-app
**Topic:** Building JWT authentication with httpOnly cookies
---
## What We Are Building
User authentication system for the Next.js app. Users register with email/password,
receive a JWT stored in an httpOnly cookie (not localStorage), and protected routes
check for a valid token via middleware. The goal is session persistence across browser
refreshes without exposing the token to JavaScript.
---
## What WORKED (with evidence)
- **`/api/auth/register` endpoint** — confirmed by: Postman POST returns 200 with user
object, row visible in Supabase dashboard, bcrypt hash stored correctly
- **JWT generation in `lib/auth.ts`** — confirmed by: unit test passes
(`npm test -- auth.test.ts`), decoded token at jwt.io shows correct payload
- **Password hashing** — confirmed by: `bcrypt.compare()` returns true in test
---
## What Did NOT Work (and why)
- **Next-Auth library** — failed because: conflicts with our custom Prisma adapter,
threw "Cannot use adapter with credentials provider in this configuration" on every
request. Not worth debugging — too opinionated for our setup.
- **Storing JWT in localStorage** — failed because: SSR renders happen before
localStorage is available, caused React hydration mismatch error on every page load.
This approach is fundamentally incompatible with Next.js SSR.
---
## What Has NOT Been Tried Yet
- Store JWT as httpOnly cookie in the login route response (most likely solution)
- Use `cookies()` from `next/headers` to read token in server components
- Write middleware.ts to protect routes by checking cookie existence
---
## Current State of Files
| File | Status | Notes |
| -------------------------------- | -------------- | ----------------------------------------------- |
| `app/api/auth/register/route.ts` | ✅ Complete | Works, tested |
| `app/api/auth/login/route.ts` | 🔄 In Progress | Token generates but not setting cookie yet |
| `lib/auth.ts` | ✅ Complete | JWT helpers, all tested |
| `middleware.ts` | 🗒️ Not Started | Route protection, needs cookie read logic first |
| `app/login/page.tsx` | 🗒️ Not Started | UI not started |
---
## Decisions Made
- **httpOnly cookie over localStorage** — reason: prevents XSS token theft, works with SSR
- **Custom auth over Next-Auth** — reason: Next-Auth conflicts with our Prisma setup, not worth the fight
---
## Blockers & Open Questions
- Does `cookies().set()` work inside a Route Handler or only in Server Actions? Need to verify.
---
## Exact Next Step
In `app/api/auth/login/route.ts`, after generating the JWT, set it as an httpOnly
cookie using `cookies().set('token', jwt, { httpOnly: true, secure: true, sameSite: 'strict' })`.
Then test with Postman — the response should include a `Set-Cookie` header.
```
---
## Notes
- Each session gets its own file — never append to a previous session's file
- The "What Did NOT Work" section is the most critical — future sessions will blindly retry failed approaches without it
- If the user asks to save mid-session (not just at the end), save what's known so far and mark in-progress items clearly
- The file is meant to be read by Claude at the start of the next session via `/resume-session`
- Use the canonical global session store: `~/.claude/sessions/`
- Prefer the short-id filename form (`YYYY-MM-DD-<short-id>-session.tmp`) for any new session file

View File

@@ -319,8 +319,10 @@ Never skip the RED phase. Never write code before tests.
## Related Agents
This command invokes the `tdd-guide` agent located at:
`~/.claude/agents/tdd-guide.md`
This command invokes the `tdd-guide` agent provided by ECC.
And can reference the `tdd-workflow` skill at:
`~/.claude/skills/tdd-workflow/`
The related `tdd-workflow` skill is also bundled with ECC.
For manual installs, the source files live at:
- `agents/tdd-guide.md`
- `skills/tdd-workflow/SKILL.md`

View File

@@ -0,0 +1,146 @@
# Architecture Improvement Recommendations
This document captures architect-level improvements for the Everything Claude Code (ECC) project. It is written from the perspective of a Claude Code coding architect aiming to improve maintainability, consistency, and long-term quality.
---
## 1. Documentation and Single Source of Truth
### 1.1 Agent / Command / Skill Count Sync
**Issue:** AGENTS.md states "13 specialized agents, 50+ skills, 33 commands" while the repo has **16 agents**, **65+ skills**, and **40 commands**. README and other docs also vary. This causes confusion for contributors and users.
**Recommendation:**
- **Single source of truth:** Derive counts (and optionally tables) from the filesystem or a small manifest. Options:
- **Option A:** Add a script (e.g. `scripts/ci/catalog.js`) that scans `agents/*.md`, `commands/*.md`, and `skills/*/SKILL.md` and outputs JSON/Markdown. CI and docs can consume this.
- **Option B:** Maintain one `docs/catalog.json` (or YAML) that lists agents, commands, and skills with metadata; scripts and docs read from it. Requires discipline to update on add/remove.
- **Short-term:** Manually sync AGENTS.md, README.md, and CLAUDE.md with actual counts and list any new agents (e.g. chief-of-staff, loop-operator, harness-optimizer) in the agent table.
**Impact:** High — affects first impression and contributor trust.
---
### 1.2 Command → Agent / Skill Map
**Issue:** There is no single machine- or human-readable map of "which command uses which agent(s) or skill(s)." This lives in README tables and individual command `.md` files, which can drift.
**Recommendation:**
- Add a **command registry** (e.g. in `docs/` or as frontmatter in command files) that lists for each command: name, description, primary agent(s), skills referenced. Can be generated from command file content or maintained by hand.
- Expose a "map" in docs (e.g. `docs/COMMAND-AGENT-MAP.md`) or in the generated catalog for discoverability and for tooling (e.g. "which commands use tdd-guide?").
**Impact:** Medium — improves discoverability and refactoring safety.
---
## 2. Testing and Quality
### 2.1 Test Discovery vs Hardcoded List
**Issue:** `tests/run-all.js` uses a **hardcoded list** of test files. New test files are not run unless someone updates `run-all.js`, so coverage can be incomplete by omission.
**Recommendation:**
- **Glob-based discovery:** Discover test files by pattern (e.g. `**/*.test.js` under `tests/`) and run them, with an optional allowlist/denylist for special cases. This makes new tests automatically part of the suite.
- Keep a single entry point (`tests/run-all.js`) that runs discovered tests and aggregates results.
**Impact:** High — prevents regression where new tests exist but are never executed.
---
### 2.2 Test Coverage Metrics
**Issue:** There is no coverage tool (e.g. nyc/c8/istanbul). The project cannot assert "80%+ coverage" for its own scripts; coverage is implicit.
**Recommendation:**
- Introduce a coverage tool for Node scripts (e.g. `c8` or `nyc`) and run it in CI. Start with a baseline (e.g. 60%) and raise over time; or at least report coverage in CI without failing so the team can see trends.
- Focus on `scripts/` (lib + hooks + ci) as the primary target; exclude one-off scripts if needed.
**Impact:** Medium — aligns the project with its own AGENTS.md guidance (80%+ coverage) and surfaces untested paths.
---
## 3. Schema and Validation
### 3.1 Use Hooks JSON Schema in CI
**Issue:** `schemas/hooks.schema.json` exists and defines the hook configuration shape, but `scripts/ci/validate-hooks.js` does **not** use it. Validation is duplicated (VALID_EVENTS, structure) and can drift from the schema.
**Recommendation:**
- Use a JSON Schema validator (e.g. `ajv`) in `validate-hooks.js` to validate `hooks/hooks.json` against `schemas/hooks.schema.json`. Keep the validator as the single source of truth for structure; retain only hook-specific checks (e.g. inline JS syntax) in the script.
- Ensures schema and validator stay in sync and allows IDE/editor validation via `$schema` in hooks.json.
**Impact:** Medium — reduces drift and improves contributor experience when editing hooks.
---
## 4. Cross-Harness and i18n
### 4.1 Skill/Agent Subset Sync (.agents/skills, .cursor/skills)
**Issue:** `.agents/skills/` (Codex) and `.cursor/skills/` are subsets of `skills/`. Adding or removing a skill in the main repo requires manually updating these subsets, which can be forgotten.
**Recommendation:**
- Document in CONTRIBUTING.md that adding a skill may require updating `.agents/skills` and `.cursor/skills` (and how to do it).
- Optionally: a CI check or script that compares `skills/` to the subsets and fails or warns if a skill is in one set but not the other when it should be (e.g. by convention or by a small manifest).
**Impact:** LowMedium — reduces cross-harness drift.
---
### 4.2 Translation Drift (docs/ zh-CN, zh-TW, ja-JP)
**Issue:** Translations in `docs/` duplicate agents, commands, skills. As the English source evolves, translations can become outdated without clear process or tooling.
**Recommendation:**
- Document a **translation process:** when to update (e.g. on release), who owns each locale, and how to detect stale content (e.g. diff file lists or key sections).
- Consider: translation status file (e.g. `docs/i18n-status.md`) or CI that checks translation file existence/timestamps and warns if English was updated more recently than a translation.
- Long-term: consider extraction/placeholder format (e.g. i18n keys) so translations reference the same structure as the English source.
**Impact:** Medium — improves experience for non-English users and reduces confusion from outdated translations.
---
## 5. Hooks and Scripts
### 5.1 Hook Runtime Consistency
**Issue:** Most hooks invoke Node scripts via `run-with-flags.js`; one path uses `run-with-flags-shell.sh` + `observe.sh`. The mixed runtime is documented but could be simplified over time.
**Recommendation:**
- Prefer Node for new hooks when possible (cross-platform, single runtime). If shell is required, document why and keep the surface small.
- Ensure `ECC_HOOK_PROFILE` and `ECC_DISABLED_HOOKS` are respected in all code paths (including shell) so behavior is consistent.
**Impact:** Low — maintains current design; improves if more hooks migrate to Node.
---
## 6. Summary Table
| Area | Improvement | Priority | Effort |
|-------------------|--------------------------------------|----------|---------|
| Doc sync | Sync AGENTS.md/README counts & table | High | Low |
| Single source | Catalog script or manifest | High | Medium |
| Test discovery | Glob-based test runner | High | Low |
| Coverage | Add c8/nyc and CI coverage | Medium | Medium |
| Hook schema in CI | Validate hooks.json via schema | Medium | Low |
| Command map | Command → agent/skill registry | Medium | Medium |
| Subset sync | Document/CI for .agents/.cursor | LowMed | LowMed |
| Translations | Process + stale detection | Medium | Medium |
| Hook runtime | Prefer Node; document shell use | Low | Low |
---
## 7. Quick Wins (Immediate)
1. **Update AGENTS.md:** Set agent count to 16; add chief-of-staff, loop-operator, harness-optimizer to the agent table; align skill/command counts with repo.
2. **Test discovery:** Change `run-all.js` to discover `**/*.test.js` under `tests/` (with optional allowlist) so new tests are always run.
3. **Wire hooks schema:** In `validate-hooks.js`, validate `hooks/hooks.json` against `schemas/hooks.schema.json` using ajv (or similar) and keep only hook-specific checks in the script.
These three can be done in one or two sessions and materially improve consistency and reliability.

61
docs/COMMAND-AGENT-MAP.md Normal file
View File

@@ -0,0 +1,61 @@
# Command → Agent / Skill Map
This document lists each slash command and the primary agent(s) or skills it invokes. Use it to discover which commands use which agents and to keep refactoring consistent.
| Command | Primary agent(s) | Notes |
|---------|------------------|--------|
| `/plan` | planner | Implementation planning before code |
| `/tdd` | tdd-guide | Test-driven development |
| `/code-review` | code-reviewer | Quality and security review |
| `/build-fix` | build-error-resolver | Fix build/type errors |
| `/e2e` | e2e-runner | Playwright E2E tests |
| `/refactor-clean` | refactor-cleaner | Dead code removal |
| `/update-docs` | doc-updater | Documentation sync |
| `/update-codemaps` | doc-updater | Codemaps / architecture docs |
| `/go-review` | go-reviewer | Go code review |
| `/go-test` | tdd-guide | Go TDD workflow |
| `/go-build` | go-build-resolver | Fix Go build errors |
| `/python-review` | python-reviewer | Python code review |
| `/harness-audit` | — | Harness scorecard (no single agent) |
| `/loop-start` | loop-operator | Start autonomous loop |
| `/loop-status` | loop-operator | Inspect loop status |
| `/quality-gate` | — | Quality pipeline (hook-like) |
| `/model-route` | — | Model recommendation (no agent) |
| `/orchestrate` | planner, tdd-guide, code-reviewer, security-reviewer, architect | Multi-agent handoff |
| `/multi-plan` | architect (Codex/Gemini prompts) | Multi-model planning |
| `/multi-execute` | architect / frontend prompts | Multi-model execution |
| `/multi-backend` | architect | Backend multi-service |
| `/multi-frontend` | architect | Frontend multi-service |
| `/multi-workflow` | architect | General multi-service |
| `/learn` | — | continuous-learning skill, instincts |
| `/learn-eval` | — | continuous-learning-v2, evaluate then save |
| `/instinct-status` | — | continuous-learning-v2 |
| `/instinct-import` | — | continuous-learning-v2 |
| `/instinct-export` | — | continuous-learning-v2 |
| `/evolve` | — | continuous-learning-v2, cluster instincts |
| `/promote` | — | continuous-learning-v2 |
| `/projects` | — | continuous-learning-v2 |
| `/skill-create` | — | skill-create-output script, git history |
| `/checkpoint` | — | verification-loop skill |
| `/verify` | — | verification-loop skill |
| `/eval` | — | eval-harness skill |
| `/test-coverage` | — | Coverage analysis |
| `/sessions` | — | Session history |
| `/setup-pm` | — | Package manager setup script |
| `/claw` | — | NanoClaw CLI (scripts/claw.js) |
| `/pm2` | — | PM2 service lifecycle |
| `/security-scan` | security-reviewer (skill) | AgentShield via security-scan skill |
## Skills referenced by commands
- **continuous-learning**, **continuous-learning-v2**: `/learn`, `/learn-eval`, `/instinct-*`, `/evolve`, `/promote`, `/projects`
- **verification-loop**: `/checkpoint`, `/verify`
- **eval-harness**: `/eval`
- **security-scan**: `/security-scan` (runs AgentShield)
- **strategic-compact**: suggested at compaction points (hooks)
## How to use this map
- **Discoverability:** Find which command triggers which agent (e.g. “use `/code-review` for code-reviewer”).
- **Refactoring:** When renaming or removing an agent, search this doc and the command files for references.
- **CI/docs:** The catalog script (`node scripts/ci/catalog.js`) outputs agent/command/skill counts; this map complements it with commandagent relationships.

141
docs/zh-CN/AGENTS.md Normal file
View File

@@ -0,0 +1,141 @@
# Everything Claude Code (ECC) — 智能体指令
这是一个**生产就绪的 AI 编码插件**,提供 13 个专业智能体、50+ 项技能、33 条命令以及用于软件开发的自动化钩子工作流。
## 核心原则
1. **智能体优先** — 将领域任务委托给专业智能体
2. **测试驱动** — 先写测试再实现,要求 80%+ 覆盖率
3. **安全第一** — 绝不妥协安全;验证所有输入
4. **不可变性** — 总是创建新对象,永不修改现有对象
5. **先规划后执行** — 在编写代码前规划复杂功能
## 可用智能体
| 智能体 | 目的 | 何时使用 |
|-------|---------|-------------|
| planner | 实施规划 | 复杂功能、重构 |
| architect | 系统设计与可扩展性 | 架构决策 |
| tdd-guide | 测试驱动开发 | 新功能、错误修复 |
| code-reviewer | 代码质量与可维护性 | 编写/修改代码后 |
| security-reviewer | 漏洞检测 | 提交前、敏感代码 |
| build-error-resolver | 修复构建/类型错误 | 构建失败时 |
| e2e-runner | 端到端 Playwright 测试 | 关键用户流程 |
| refactor-cleaner | 清理无用代码 | 代码维护 |
| doc-updater | 文档和代码地图更新 | 更新文档 |
| go-reviewer | Go 代码审查 | Go 项目 |
| go-build-resolver | Go 构建错误 | Go 构建失败 |
| database-reviewer | PostgreSQL/Supabase 专家 | 模式设计、查询优化 |
| python-reviewer | Python 代码审查 | Python 项目 |
## 智能体编排
主动使用智能体,无需用户提示:
* 复杂功能请求 → **planner**
* 刚编写/修改的代码 → **code-reviewer**
* 错误修复或新功能 → **tdd-guide**
* 架构决策 → **architect**
* 安全敏感代码 → **security-reviewer**
对于独立操作使用并行执行 — 同时启动多个智能体。
## 安全指南
**在任何提交之前:**
* 没有硬编码的密钥API 密钥、密码、令牌)
* 所有用户输入都经过验证
* 防止 SQL 注入(参数化查询)
* 防止 XSS已清理的 HTML
* 启用 CSRF 保护
* 已验证身份验证/授权
* 所有端点都有限速
* 错误消息不泄露敏感数据
**密钥管理:** 绝不硬编码密钥。使用环境变量或密钥管理器。在启动时验证所需的密钥。立即轮换任何暴露的密钥。
**如果发现安全问题:** 停止 → 使用 security-reviewer 智能体 → 修复 CRITICAL 问题 → 轮换暴露的密钥 → 审查代码库中的类似问题。
## 编码风格
**不可变性(关键):** 总是创建新对象,永不修改。返回带有更改的新副本。
**文件组织:** 许多小文件优于少数大文件。通常 200-400 行,最多 800 行。按功能/领域组织,而不是按类型组织。高内聚,低耦合。
**错误处理:** 在每个层级处理错误。在 UI 代码中提供用户友好的消息。在服务器端记录详细的上下文。绝不静默地忽略错误。
**输入验证:** 在系统边界验证所有用户输入。使用基于模式的验证。快速失败并给出清晰的消息。绝不信任外部数据。
**代码质量检查清单:**
* 函数小巧(<50 行),文件专注(<800 行)
* 没有深层嵌套(>4 层)
* 适当的错误处理,没有硬编码的值
* 可读性强、命名良好的标识符
## 测试要求
**最低覆盖率80%**
测试类型(全部必需):
1. **单元测试** — 单个函数、工具、组件
2. **集成测试** — API 端点、数据库操作
3. **端到端测试** — 关键用户流程
**TDD 工作流(强制):**
1. 先写测试RED — 测试应该失败
2. 编写最小实现GREEN — 测试应该通过
3. 重构IMPROVE — 验证覆盖率 80%+
故障排除:检查测试隔离 → 验证模拟 → 修复实现(而不是测试,除非测试是错误的)。
## 开发工作流
1. **规划** — 使用 planner 智能体,识别依赖项和风险,分解为阶段
2. **TDD** — 使用 tdd-guide 智能体,先写测试,实现,重构
3. **审查** — 立即使用 code-reviewer 智能体,解决 CRITICAL/HIGH 问题
4. **提交** — 约定式提交格式,全面的 PR 摘要
## Git 工作流
**提交格式:** `<type>: <description>` — 类型feat, fix, refactor, docs, test, chore, perf, ci
**PR 工作流:** 分析完整的提交历史 → 起草全面的摘要 → 包含测试计划 → 使用 `-u` 标志推送。
## 架构模式
**API 响应格式:** 具有成功指示器、数据负载、错误消息和分页元数据的一致信封。
**仓储模式:** 将数据访问封装在标准接口findAll, findById, create, update, delete后面。业务逻辑依赖于抽象接口而不是存储机制。
**骨架项目:** 搜索经过实战检验的模板,使用并行智能体(安全性、可扩展性、相关性)进行评估,克隆最佳匹配,在已验证的结构内迭代。
## 性能
**上下文管理:** 对于大型重构和多文件功能,避免使用上下文窗口的最后 20%。敏感性较低的任务(单次编辑、文档、简单修复)可以容忍较高的利用率。
**构建故障排除:** 使用 build-error-resolver 智能体 → 分析错误 → 增量修复 → 每次修复后验证。
## 项目结构
```
agents/ — 13 specialized subagents
skills/ — 50+ workflow skills and domain knowledge
commands/ — 33 slash commands
hooks/ — Trigger-based automations
rules/ — Always-follow guidelines (common + per-language)
scripts/ — Cross-platform Node.js utilities
mcp-configs/ — 14 MCP server configurations
tests/ — Test suite
```
## 成功指标
* 所有测试通过且覆盖率 80%+
* 没有安全漏洞
* 代码可读且可维护
* 性能可接受
* 满足用户需求

46
docs/zh-CN/CHANGELOG.md Normal file
View File

@@ -0,0 +1,46 @@
# 更新日志
## 1.8.0 - 2026-03-04
### 亮点
* 首次发布以可靠性、评估规程和自主循环操作为核心的版本。
* Hook 运行时现在支持基于配置文件的控制和针对性的 Hook 禁用。
* NanoClaw v2 增加了模型路由、技能热加载、分支、搜索、压缩、导出和指标功能。
### 核心
* 新增命令:`/harness-audit`, `/loop-start`, `/loop-status`, `/quality-gate`, `/model-route`
* 新增技能:
* `agent-harness-construction`
* `agentic-engineering`
* `ralphinho-rfc-pipeline`
* `ai-first-engineering`
* `enterprise-agent-ops`
* `nanoclaw-repl`
* `continuous-agent-loop`
* 新增代理:
* `harness-optimizer`
* `loop-operator`
### Hook 可靠性
* 修复了 SessionStart 的根路径解析,增加了健壮的回退搜索。
* 将会话摘要持久化移至 `Stop`,此处可获得转录负载。
* 增加了质量门和成本追踪钩子。
* 用专门的脚本文件替换了脆弱的单行内联钩子。
* 增加了 `ECC_HOOK_PROFILE``ECC_DISABLED_HOOKS` 控制。
### 跨平台
* 改进了文档警告逻辑中 Windows 安全路径的处理。
* 强化了观察者循环行为,以避免非交互式挂起。
### 备注
* `autonomous-loops` 作为一个兼容性别名保留一个版本;`continuous-agent-loop` 是规范名称。
### 鸣谢
* 灵感来自 [zarazhangrui](https://github.com/zarazhangrui)
* homunculus 灵感来自 [humanplane](https://github.com/humanplane)

61
docs/zh-CN/CLAUDE.md Normal file
View File

@@ -0,0 +1,61 @@
# CLAUDE.md
本文件为 Claude Code (claude.ai/code) 处理此仓库代码时提供指导。
## 项目概述
这是一个 **Claude Code 插件** - 一个包含生产就绪的代理、技能、钩子、命令、规则和 MCP 配置的集合。该项目提供了使用 Claude Code 进行软件开发的经验证的工作流。
## 运行测试
```bash
# Run all tests
node tests/run-all.js
# Run individual test files
node tests/lib/utils.test.js
node tests/lib/package-manager.test.js
node tests/hooks/hooks.test.js
```
## 架构
项目组织为以下几个核心组件:
* **agents/** - 用于委派的专业化子代理规划器、代码审查员、TDD 指南等)
* **skills/** - 工作流定义和领域知识(编码标准、模式、测试)
* **commands/** - 由用户调用的斜杠命令(/tdd, /plan, /e2e 等)
* **hooks/** - 基于触发的自动化(会话持久化、工具前后钩子)
* **rules/** - 始终遵循的指南(安全、编码风格、测试要求)
* **mcp-configs/** - 用于外部集成的 MCP 服务器配置
* **scripts/** - 用于钩子和设置的跨平台 Node.js 工具
* **tests/** - 脚本和工具的测试套件
## 关键命令
* `/tdd` - 测试驱动开发工作流
* `/plan` - 实施规划
* `/e2e` - 生成并运行端到端测试
* `/code-review` - 质量审查
* `/build-fix` - 修复构建错误
* `/learn` - 从会话中提取模式
* `/skill-create` - 从 git 历史记录生成技能
## 开发说明
* 包管理器检测npm、pnpm、yarn、bun可通过 `CLAUDE_PACKAGE_MANAGER` 环境变量或项目配置设置)
* 跨平台:通过 Node.js 脚本支持 Windows、macOS、Linux
* 代理格式:带有 YAML 前言的 Markdown名称、描述、工具、模型
* 技能格式:带有清晰章节的 Markdown何时使用、如何工作、示例
* 钩子格式:带有匹配器条件和命令/通知钩子的 JSON
## 贡献
遵循 CONTRIBUTING.md 中的格式:
* 代理:带有前言的 Markdown名称、描述、工具、模型
* 技能:清晰的章节(何时使用、如何工作、示例)
* 命令:带有描述前言的 Markdown
* 钩子:带有匹配器和钩子数组的 JSON
文件命名:小写字母并用连字符连接(例如 `python-reviewer.md`, `tdd-workflow.md`

View File

@@ -0,0 +1,84 @@
# 贡献者公约行为准则
## 我们的承诺
作为成员、贡献者和领导者,我们承诺,无论年龄、体型、显性或隐性残疾、民族、性征、性别认同与表达、经验水平、教育程度、社会经济地位、国籍、外貌、种族、宗教或性取向如何,都努力使参与我们社区成为对每个人而言免受骚扰的体验。
我们承诺以有助于建立一个开放、友好、多元、包容和健康的社区的方式行事和互动。
## 我们的标准
有助于为我们社区营造积极环境的行为示例包括:
* 对他人表现出同理心和善意
* 尊重不同的意见、观点和经验
* 给予并优雅地接受建设性反馈
* 承担责任,向受我们错误影响的人道歉,并从经验中学习
* 关注不仅对我们个人而言是最好的,而且对整个社区而言是最好的事情
不可接受的行为示例包括:
* 使用性暗示的语言或图像,以及任何形式的性关注或性接近
* 挑衅、侮辱或贬损性评论,以及个人或政治攻击
* 公开或私下骚扰
* 未经他人明确许可,发布他人的私人信息,例如物理地址或电子邮件地址
* 其他在专业环境中可能被合理认为不当的行为
## 执行责任
社区领导者有责任澄清和执行我们可接受行为的标准,并将对他们认为不当、威胁、冒犯或有害的任何行为采取适当和公平的纠正措施。
社区领导者有权也有责任删除、编辑或拒绝与《行为准则》不符的评论、提交、代码、wiki 编辑、问题和其他贡献,并将在适当时沟通审核决定的原因。
## 适用范围
本《行为准则》适用于所有社区空间,也适用于个人在公共空间正式代表社区时。代表我们社区的示例包括使用官方电子邮件地址、通过官方社交媒体帐户发帖,或在在线或线下活动中担任指定代表。
## 执行
辱骂、骚扰或其他不可接受行为的实例可以向负责执行的社区领导者报告,邮箱为。
所有投诉都将得到及时和公正的审查和调查。
所有社区领导者都有义务尊重任何事件报告者的隐私和安全。
## 执行指南
社区领导者在确定他们认为违反本《行为准则》的任何行为的后果时,将遵循以下社区影响指南:
### 1. 纠正
**社区影响**:使用不当语言或社区认为不专业或不受欢迎的其他行为。
**后果**:来自社区领导者的私人书面警告,阐明违规行为的性质并解释该行为为何不当。可能会要求进行公开道歉。
### 2. 警告
**社区影响**:通过单一事件或一系列行为造成的违规。
**后果**:带有持续行为后果的警告。在规定时间内,不得与相关人员互动,包括未经请求与执行《行为准则》的人员互动。这包括避免在社区空间以及社交媒体等外部渠道进行互动。违反这些条款可能导致暂时或永久封禁。
### 3. 暂时封禁
**社区影响**:严重违反社区标准,包括持续的不当行为。
**后果**:在规定时间内,禁止与社区进行任何形式的互动或公开交流。在此期间,不允许与相关人员进行公开或私下互动,包括未经请求与执行《行为准则》的人员互动。违反这些条款可能导致永久封禁。
### 4. 永久封禁
**社区影响**:表现出违反社区标准的模式,包括持续的不当行为、骚扰个人,或对特定人群表现出攻击性或贬损。
**后果**:永久禁止在社区内进行任何形式的公开互动。
## 归属
本《行为准则》改编自 \[Contributor Covenant]\[homepage]
版本 2.0,可在
https://www.contributor-covenant.org/version/2/0/code\_of\_conduct.html 获取。
社区影响指南的灵感来源于 [Mozilla 的行为准则执行阶梯](https://github.com/mozilla/diversity)。
[homepage]: https://www.contributor-covenant.org
有关本行为准则常见问题的解答,请参阅常见问题解答:
https://www.contributor-covenant.org/faq。翻译版本可在
https://www.contributor-covenant.org/translations 获取。

View File

@@ -70,7 +70,7 @@ cp -r skills/my-skill ~/.claude/skills/ # for skills
# Then test with Claude Code
# 5. Submit PR
git add . && git commit -m "feat: add my-skill" && git push
git add . && git commit -m "feat: add my-skill" && git push -u origin feat/my-contribution
```
***

View File

@@ -1,10 +1,13 @@
**语言:** 英语 | [繁體中文](../zh-TW/README.md) | [简体中文](../../README.md)
**语言:** [English](../../README.md) | [繁體中文](../zh-TW/README.md) | [简体中文](README.md)
# Everything Claude Code
[![Stars](https://img.shields.io/github/stars/affaan-m/everything-claude-code?style=flat)](https://github.com/affaan-m/everything-claude-code/stargazers)
[![Forks](https://img.shields.io/github/forks/affaan-m/everything-claude-code?style=flat)](https://github.com/affaan-m/everything-claude-code/network/members)
[![Contributors](https://img.shields.io/github/contributors/affaan-m/everything-claude-code?style=flat)](https://github.com/affaan-m/everything-claude-code/graphs/contributors)
[![npm ecc-universal](https://img.shields.io/npm/dw/ecc-universal?label=ecc-universal%20weekly%20downloads\&logo=npm)](https://www.npmjs.com/package/ecc-universal)
[![npm ecc-agentshield](https://img.shields.io/npm/dw/ecc-agentshield?label=ecc-agentshield%20weekly%20downloads\&logo=npm)](https://www.npmjs.com/package/ecc-agentshield)
[![GitHub App Install](https://img.shields.io/badge/GitHub%20App-150%20installs-2ea44f?logo=github)](https://github.com/marketplace/ecc-tools)
[![License](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)
![Shell](https://img.shields.io/badge/-Shell-4EAA25?logo=gnu-bash\&logoColor=white)
![TypeScript](https://img.shields.io/badge/-TypeScript-3178C6?logo=typescript\&logoColor=white)
@@ -27,9 +30,29 @@
***
**Anthropic 黑客马拉松获胜者提供的完整 Claude Code 配置集合**
**适用于 AI 智能体平台的性能优化系统。来自 Anthropic 黑客马拉松的获奖作品**
经过 10 多个月的密集日常使用,在构建真实产品的过程中演化出的生产就绪的智能体、技能、钩子、命令、规则和 MCP 配置。
不仅仅是配置。一个完整的系统:技能、本能、内存优化、持续学习、安全扫描以及研究优先的开发。经过 10 多个月的密集日常使用构建真实产品的经验,演进出生产就绪的智能体、钩子、命令、规则和 MCP 配置。
适用于 **Claude Code**、**Codex**、**Cowork** 以及其他 AI 智能体平台。
***
## 采用与分发
向赞助商、平台或生态系统合作伙伴展示 ECC 时,请使用这些实时信号:
* **主包安装量:** npm 上的 [`ecc-universal`](https://www.npmjs.com/package/ecc-universal)
* **安全伴侣安装量:** npm 上的 [`ecc-agentshield`](https://www.npmjs.com/package/ecc-agentshield)
* **GitHub 应用分发:** [ECC 工具市场列表](https://github.com/marketplace/ecc-tools)
* **自动化月度指标问题:** 由 `.github/workflows/monthly-metrics.yml` 驱动
* **仓库采用信号:** 本 README 顶部的 stars/forks/contributors 徽章
Claude Code 插件安装的下载计数目前尚未作为公共 API 公开。对于合作伙伴报告,请将 npm 指标与 GitHub 应用安装量以及仓库流量/分支增长相结合。
有关赞助商通话的指标清单和命令片段,请参阅 [`docs/business/metrics-and-sponsorship.md`](../business/metrics-and-sponsorship.md)。
[**赞助 ECC**](https://github.com/sponsors/affaan-m) | [赞助层级](SPONSORS.md) | [赞助计划](SPONSORING.md)
***
@@ -69,6 +92,16 @@
## 最新动态
### v1.8.0 — 平台性能系统2026 年 3 月)
* **平台优先发布** — ECC 现在被明确构建为一个智能体平台性能系统,而不仅仅是一个配置包。
* **钩子可靠性大修** — SessionStart 根回退、Stop 阶段会话摘要,以及用基于脚本的钩子替换脆弱的单行内联钩子。
* **钩子运行时控制** — `ECC_HOOK_PROFILE=minimal|standard|strict``ECC_DISABLED_HOOKS=...` 用于运行时门控,无需编辑钩子文件。
* **新平台命令** — `/harness-audit``/loop-start``/loop-status``/quality-gate``/model-route`
* **NanoClaw v2** — 模型路由、技能热加载、会话分支/搜索/导出/压缩/指标。
* **跨平台一致性** — 在 Claude Code、Cursor、OpenCode 和 Codex 应用/CLI 中行为更加统一。
* **997 项内部测试通过** — 钩子/运行时重构和兼容性更新后,完整套件全部通过。
### v1.7.0 — 跨平台扩展与演示文稿生成器2026年2月
* **Codex 应用 + CLI 支持** — 基于 `AGENTS.md` 的直接 Codex 支持、安装器目标定位以及 Codex 文档
@@ -145,6 +178,8 @@ cd everything-claude-code
# ./install.sh typescript python golang
# or target cursor:
# ./install.sh --target cursor typescript
# or target antigravity:
# ./install.sh --target antigravity typescript
```
手动安装说明请参阅 `rules/` 文件夹中的 README。
@@ -162,13 +197,13 @@ cd everything-claude-code
/plugin list everything-claude-code@everything-claude-code
```
**就是这样** 现在可以访问 13代理、56 个技能和 32 个命令。
**搞定** 现在可以访问 16智能体、65 项技能和 40 条命令。
***
## 🌐 跨平台支持
此插件现已完全支持 **Windows、macOS 和 Linux**。所有钩子和脚本都已用 Node.js 重写,以实现最大兼容性。
此插件现已完全支持 **Windows、macOS 和 Linux**,并与主流 IDECursor、OpenCode、Antigravity和 CLI 平台紧密集成。所有钩子和脚本都已用 Node.js 重写,以实现最大兼容性。
### 包管理器检测
@@ -199,6 +234,18 @@ node scripts/setup-package-manager.js --detect
或者在 Claude Code 中使用 `/setup-pm` 命令。
### 钩子运行时控制
使用运行时标志来调整严格性或临时禁用特定钩子:
```bash
# Hook strictness profile (default: standard)
export ECC_HOOK_PROFILE=standard
# Comma-separated hook IDs to disable
export ECC_DISABLED_HOOKS="pre:bash:tmux-reminder,post:edit:typecheck"
```
***
## 📦 包含内容
@@ -211,135 +258,137 @@ everything-claude-code/
| |-- plugin.json # 插件元数据和组件路径
| |-- marketplace.json # 用于 /plugin marketplace add 的市场目录
|
|-- agents/ # 用于委派的专用子代理
|-- agents/ # 用于委派任务的专用子代理
| |-- planner.md # 功能实现规划
| |-- architect.md # 系统设计决策
| |-- tdd-guide.md # 测试驱动开发
| |-- code-reviewer.md # 质量安全审查
| |-- code-reviewer.md # 质量安全审查
| |-- security-reviewer.md # 漏洞分析
| |-- build-error-resolver.md
| |-- e2e-runner.md # Playwright 端到端测试
| |-- e2e-runner.md # Playwright E2E 测试
| |-- refactor-cleaner.md # 无用代码清理
| |-- doc-updater.md # 文档同步
| |-- go-reviewer.md # Go 代码审查
| |-- go-build-resolver.md # Go 构建错误修复
| |-- python-reviewer.md # Python 代码审查新增
| |-- database-reviewer.md # 数据库/Supabase 审查新增
| |-- python-reviewer.md # Python 代码审查 (新增)
| |-- database-reviewer.md # 数据库 / Supabase 审查 (新增)
|
|-- skills/ # 工作流定义领域知识
| |-- coding-standards/ # 语言最佳实践
| |-- clickhouse-io/ # ClickHouse 分析、查询数据工程
|-- skills/ # 工作流定义领域知识
| |-- coding-standards/ # 语言最佳实践
| |-- clickhouse-io/ # ClickHouse 分析、查询数据工程
| |-- backend-patterns/ # API、数据库、缓存模式
| |-- frontend-patterns/ # React、Next.js 模式
| |-- frontend-slides/ # HTML 幻灯片 PPTX 转 Web 演示流程新增
| |-- article-writing/ # 使用指定风格进行长文写作避免通用 AI 语气新增
| |-- content-engine/ # 多平台内容创作与再利用工作流新增
| |-- market-research/ # 带来源标注的市场、竞品投资研究新增
| |-- investor-materials/ # 融资路演材料、单页、备忘录财务模型新增
| |-- investor-outreach/ # 个性化融资外联与跟进新增
| |-- continuous-learning/ # 从会话中自动提取模式(长文指南)
| |-- frontend-slides/ # HTML 幻灯片 PPTX 转 Web 演示流程 (新增)
| |-- article-writing/ # 使用指定风格进行长文写作避免通用 AI 语气 (新增)
| |-- content-engine/ # 多平台内容生成与复用工作流 (新增)
| |-- market-research/ # 带来源引用的市场、竞品投资研究 (新增)
| |-- investor-materials/ # 融资演示文稿、单页、备忘录财务模型 (新增)
| |-- investor-outreach/ # 个性化融资外联与跟进 (新增)
| |-- continuous-learning/ # 从会话中自动提取模式 (Longform Guide)
| |-- continuous-learning-v2/ # 基于直觉的学习与置信度评分
| |-- iterative-retrieval/ # 子代理渐进式上下文优化
| |-- strategic-compact/ # 手动压缩建议(长文指南)
| |-- iterative-retrieval/ # 子代理渐进式上下文优化
| |-- strategic-compact/ # 手动压缩建议 (Longform Guide)
| |-- tdd-workflow/ # TDD 方法论
| |-- security-review/ # 安全检查清单
| |-- eval-harness/ # 验证循环评估(长文指南)
| |-- verification-loop/ # 持续验证(长文指南)
| |-- golang-patterns/ # Go 惯用法最佳实践
| |-- golang-testing/ # Go 测试模式、TDD基准测试
| |-- cpp-coding-standards/ # 来自 C++ Core Guidelines 的 C++ 编码规范新增
| |-- cpp-testing/ # 使用 GoogleTestCMake/CTest 的 C++ 测试新增
| |-- django-patterns/ # Django 模式、模型视图新增
| |-- django-security/ # Django 安全最佳实践新增
| |-- django-tdd/ # Django TDD 工作流新增
| |-- django-verification/ # Django 验证循环新增
| |-- python-patterns/ # Python 惯用法最佳实践新增
| |-- python-testing/ # 使用 pytest 的 Python 测试新增
| |-- springboot-patterns/ # Java Spring Boot 模式新增
| |-- springboot-security/ # Spring Boot 安全新增
| |-- springboot-tdd/ # Spring Boot TDD新增
| |-- springboot-verification/ # Spring Boot 验证新增
| |-- configure-ecc/ # 交互式安装向导新增
| |-- security-scan/ # AgentShield 安全审计集成新增
| |-- java-coding-standards/ # Java 编码规范新增
| |-- jpa-patterns/ # JPA/Hibernate 模式新增
| |-- postgres-patterns/ # PostgreSQL 优化模式新增
| |-- nutrient-document-processing/ # 使用 Nutrient API 文档处理新增
| |-- eval-harness/ # 验证循环评估 (Longform Guide)
| |-- verification-loop/ # 持续验证 (Longform Guide)
| |-- golang-patterns/ # Go 语言惯用法最佳实践
| |-- golang-testing/ # Go 测试模式、TDD基准测试
| |-- cpp-coding-standards/ # 来自 C++ Core Guidelines 的 C++ 编码规范 (新增)
| |-- cpp-testing/ # 使用 GoogleTestCMake/CTest 的 C++ 测试 (新增)
| |-- django-patterns/ # Django 模式、模型视图 (新增)
| |-- django-security/ # Django 安全最佳实践 (新增)
| |-- django-tdd/ # Django TDD 工作流 (新增)
| |-- django-verification/ # Django 验证循环 (新增)
| |-- python-patterns/ # Python 惯用法最佳实践 (新增)
| |-- python-testing/ # 使用 pytest 的 Python 测试 (新增)
| |-- springboot-patterns/ # Java Spring Boot 模式 (新增)
| |-- springboot-security/ # Spring Boot 安全 (新增)
| |-- springboot-tdd/ # Spring Boot TDD (新增)
| |-- springboot-verification/ # Spring Boot 验证流程 (新增)
| |-- configure-ecc/ # 交互式安装向导 (新增)
| |-- security-scan/ # AgentShield 安全审计集成 (新增)
| |-- java-coding-standards/ # Java 编码规范 (新增)
| |-- jpa-patterns/ # JPA/Hibernate 模式 (新增)
| |-- postgres-patterns/ # PostgreSQL 优化模式 (新增)
| |-- nutrient-document-processing/ # 使用 Nutrient API 进行文档处理 (新增)
| |-- project-guidelines-example/ # 项目专用技能模板
| |-- database-migrations/ # 迁移模式Prisma、Drizzle、Django、Go新增
| |-- api-design/ # REST API 设计、分页错误响应新增
| |-- deployment-patterns/ # CI/CD、Docker、健康检查回滚新增
| |-- docker-patterns/ # Docker Compose、网络、卷容器安全新增
| |-- e2e-testing/ # Playwright 端到端模式与页面对象模型(新增
| |-- content-hash-cache-pattern/ # 基于 SHA-256 内容哈希文件处理缓存新增
| |-- cost-aware-llm-pipeline/ # LLM 成本优化、模型路由预算跟踪新增
| |-- regex-vs-llm-structured-text/ # 决策框架:文本解析使用正则还是 LLM新增
| |-- swift-actor-persistence/ # 使用 Actor 实现线程安全 Swift 数据持久化新增
| |-- swift-protocol-di-testing/ # 基于协议的依赖注入,实现可测试 Swift 代码新增
| |-- search-first/ # 先研究编码的工作流新增
| |-- skill-stocktake/ # 技能命令质量审计(新增
| |-- liquid-glass-design/ # iOS 26 Liquid Glass 设计系统新增
| |-- foundation-models-on-device/ # Apple 设备端 LLM FoundationModels新增
| |-- swift-concurrency-6-2/ # Swift 6.2 易用并发新增
| |-- database-migrations/ # 数据库迁移模式 (Prisma、Drizzle、Django、Go) (新增)
| |-- api-design/ # REST API 设计、分页错误响应 (新增)
| |-- deployment-patterns/ # CI/CD、Docker、健康检查回滚 (新增)
| |-- docker-patterns/ # Docker Compose、网络、卷容器安全 (新增)
| |-- e2e-testing/ # Playwright E2E 模式和 Page Object Model (新增)
| |-- content-hash-cache-pattern/ # 使用 SHA-256 内容哈希进行文件处理缓存 (新增)
| |-- cost-aware-llm-pipeline/ # LLM 成本优化、模型路由预算跟踪 (新增)
| |-- regex-vs-llm-structured-text/ # 文本解析决策框架:正则 vs LLM (新增)
| |-- swift-actor-persistence/ # 使用 Actor 线程安全 Swift 数据持久化 (新增)
| |-- swift-protocol-di-testing/ # 基于 Protocol 的依赖注入用于可测试 Swift 代码 (新增)
| |-- search-first/ # 先研究编码的工作流 (新增)
| |-- skill-stocktake/ # 审计技能命令质量 (新增)
| |-- liquid-glass-design/ # iOS 26 Liquid Glass 设计系统 (新增)
| |-- foundation-models-on-device/ # Apple 设备端 LLM FoundationModels (新增)
| |-- swift-concurrency-6-2/ # Swift 6.2 易用并发模型 (新增)
| |-- autonomous-loops/ # 自动化循环模式顺序流水线、PR 循环、DAG 编排 (新增)
| |-- plankton-code-quality/ # 使用 Plankton hooks 在编写阶段执行代码质量检查 (新增)
|
|-- commands/ # 快速执行的斜杠命令
|-- commands/ # 用于快速执行的 Slash 命令
| |-- tdd.md # /tdd - 测试驱动开发
| |-- plan.md # /plan - 实现规划
| |-- e2e.md # /e2e - 端到端测试生成
| |-- code-review.md # /code-review - 质量审查
| |-- e2e.md # /e2e - E2E 测试生成
| |-- code-review.md # /code-review - 代码质量审查
| |-- build-fix.md # /build-fix - 修复构建错误
| |-- refactor-clean.md # /refactor-clean - 无用代码清理
| |-- learn.md # /learn - 会话中提取模式(长文指南)
| |-- learn-eval.md # /learn-eval - 提取、评估并保存模式新增
| |-- checkpoint.md # /checkpoint - 保存验证状态(长文指南)
| |-- verify.md # /verify - 行验证循环(长文指南)
| |-- refactor-clean.md # /refactor-clean - 删除无用代码
| |-- learn.md # /learn - 会话中提取模式 (Longform Guide)
| |-- learn-eval.md # /learn-eval - 提取、评估并保存模式 (新增)
| |-- checkpoint.md # /checkpoint - 保存验证状态 (Longform Guide)
| |-- verify.md # /verify - 行验证循环 (Longform Guide)
| |-- setup-pm.md # /setup-pm - 配置包管理器
| |-- go-review.md # /go-review - Go 代码审查新增
| |-- go-test.md # /go-test - Go TDD 工作流新增
| |-- go-build.md # /go-build - 修复 Go 构建错误新增
| |-- skill-create.md # /skill-create - 从 git 历史生成技能新增
| |-- instinct-status.md # /instinct-status - 查看学习的直觉新增
| |-- instinct-import.md # /instinct-import - 导入直觉新增
| |-- instinct-export.md # /instinct-export - 导出直觉新增
| |-- go-review.md # /go-review - Go 代码审查 (新增)
| |-- go-test.md # /go-test - Go TDD 工作流 (新增)
| |-- go-build.md # /go-build - 修复 Go 构建错误 (新增)
| |-- skill-create.md # /skill-create - 从 git 历史生成技能 (新增)
| |-- instinct-status.md # /instinct-status - 查看学习的直觉规则 (新增)
| |-- instinct-import.md # /instinct-import - 导入直觉规则 (新增)
| |-- instinct-export.md # /instinct-export - 导出直觉规则 (新增)
| |-- evolve.md # /evolve - 将直觉聚类为技能
| |-- pm2.md # /pm2 - PM2 服务生命周期管理新增
| |-- multi-plan.md # /multi-plan - 多代理任务拆解新增
| |-- multi-execute.md # /multi-execute - 编排式多代理工作流新增
| |-- multi-backend.md # /multi-backend - 后端多服务编排新增
| |-- multi-frontend.md # /multi-frontend - 前端多服务编排新增
| |-- multi-workflow.md # /multi-workflow - 通用多服务工作流新增
| |-- pm2.md # /pm2 - PM2 服务生命周期管理 (新增)
| |-- multi-plan.md # /multi-plan - 多代理任务拆解 (新增)
| |-- multi-execute.md # /multi-execute - 编排式多代理工作流 (新增)
| |-- multi-backend.md # /multi-backend - 后端多服务编排 (新增)
| |-- multi-frontend.md # /multi-frontend - 前端多服务编排 (新增)
| |-- multi-workflow.md # /multi-workflow - 通用多服务工作流 (新增)
| |-- orchestrate.md # /orchestrate - 多代理协调
| |-- sessions.md # /sessions - 会话历史管理
| |-- eval.md # /eval - 按标准评估
| |-- eval.md # /eval - 按标准进行评估
| |-- test-coverage.md # /test-coverage - 测试覆盖率分析
| |-- update-docs.md # /update-docs - 更新文档
| |-- update-codemaps.md # /update-codemaps - 更新代码映射
| |-- python-review.md # /python-review - Python 代码审查新增
| |-- update-codemaps.md # /update-codemaps - 更新代码地图
| |-- python-review.md # /python-review - Python 代码审查 (新增)
|
|-- rules/ # 必须遵循的规则复制到 ~/.claude/rules/
| |-- README.md # 结构说明与安装指南
|-- rules/ # 必须遵循的规则 (复制到 ~/.claude/rules/)
| |-- README.md # 结构概览和安装指南
| |-- common/ # 与语言无关的原则
| | |-- coding-style.md # 不可变性文件组织
| | |-- git-workflow.md # 提交格式PR 流程
| | |-- testing.md # TDD80% 覆盖率要求
| | |-- performance.md # 模型选择上下文管理
| | |-- patterns.md # 设计模式骨架项目
| | |-- hooks.md # Hook 架构TodoWrite
| | |-- coding-style.md # 不可变性文件组织
| | |-- git-workflow.md # 提交格式PR 流程
| | |-- testing.md # TDD80% 覆盖率要求
| | |-- performance.md # 模型选择上下文管理
| | |-- patterns.md # 设计模式骨架项目
| | |-- hooks.md # Hook 架构TodoWrite
| | |-- agents.md # 何时委派给子代理
| | |-- security.md # 强制安全检查
| |-- typescript/ # TypeScript/JavaScript 专用
| | |-- security.md # 必须执行的安全检查
| |-- typescript/ # TypeScript / JavaScript 专用
| |-- python/ # Python 专用
| |-- golang/ # Go 专用
|
|-- hooks/ # 基于触发器的自动化
| |-- README.md # Hook 文档、示例自定义指南
| |-- hooks.json # 所有 Hook 配置PreToolUse、PostToolUse、Stop 等
| |-- memory-persistence/ # 会话生命周期 Hook(长文指南)
| |-- strategic-compact/ # 压缩建议(长文指南)
| |-- README.md # Hook 文档、示例自定义指南
| |-- hooks.json # 所有 Hook 配置 (PreToolUse、PostToolUse、Stop 等)
| |-- memory-persistence/ # 会话生命周期 Hook (Longform Guide)
| |-- strategic-compact/ # 压缩建议 (Longform Guide)
|
|-- scripts/ # 跨平台 Node.js 脚本新增
|-- scripts/ # 跨平台 Node.js 脚本 (新增)
| |-- lib/ # 共享工具
| | |-- utils.js # 跨平台文件/路径/系统工具
| | |-- utils.js # 跨平台文件 / 路径 / 系统工具
| | |-- package-manager.js # 包管理器检测与选择
| |-- hooks/ # Hook 实现
| | |-- session-start.js # 会话开始时加载上下文
@@ -349,28 +398,28 @@ everything-claude-code/
| | |-- evaluate-session.js # 从会话中提取模式
| |-- setup-package-manager.js # 交互式包管理器设置
|
|-- tests/ # 测试套件新增
|-- tests/ # 测试套件 (新增)
| |-- lib/ # 库测试
| |-- hooks/ # Hook 测试
| |-- run-all.js # 运行所有测试
|
|-- contexts/ # 动态系统提示注入上下文(长文指南)
|-- contexts/ # 动态系统提示上下文注入 (Longform Guide)
| |-- dev.md # 开发模式上下文
| |-- review.md # 代码审查模式上下文
| |-- research.md # 研究/探索模式上下文
| |-- research.md # 研究 / 探索模式上下文
|
|-- examples/ # 示例配置会话
|-- examples/ # 示例配置会话
| |-- CLAUDE.md # 项目级配置示例
| |-- user-CLAUDE.md # 用户级配置示例
| |-- saas-nextjs-CLAUDE.md # 实 SaaS 示例Next.js + Supabase + Stripe
| |-- go-microservice-CLAUDE.md # 实 Go 微服务示例gRPC + PostgreSQL
| |-- django-api-CLAUDE.md # 实 Django REST API 示例DRF + Celery
| |-- rust-api-CLAUDE.md # 实 Rust API 示例Axum + SQLx + PostgreSQL新增
| |-- saas-nextjs-CLAUDE.md # 实 SaaS 示例 (Next.js + Supabase + Stripe)
| |-- go-microservice-CLAUDE.md # 实 Go 微服务示例 (gRPC + PostgreSQL)
| |-- django-api-CLAUDE.md # 实 Django REST API 示例 (DRF + Celery)
| |-- rust-api-CLAUDE.md # 实 Rust API 示例 (Axum + SQLx + PostgreSQL) (新增)
|
|-- mcp-configs/ # MCP 服务器配置
| |-- mcp-servers.json # GitHub、Supabase、Vercel、Railway 等
|
|-- marketplace.json # 自托管市场配置用于 /plugin marketplace add
|-- marketplace.json # 自托管市场配置 (用于 /plugin marketplace add)
```
***
@@ -441,6 +490,10 @@ npx ecc-agentshield init
[GitHub](https://github.com/affaan-m/agentshield) | [npm](https://www.npmjs.com/package/ecc-agentshield)
### 🔬 Plankton — 编写时代码质量强制执行
Plankton致谢@alxfazio)是用于编写时代码质量强制执行的推荐伴侣。它通过 PostToolUse 钩子在每次文件编辑时运行格式化程序和 20 多个代码检查器,然后生成 Claude 子进程(根据违规复杂度路由到 Haiku/Sonnet/Opus来修复主智能体遗漏的问题。采用三阶段架构静默自动格式化解决 40-50% 的问题),将剩余的违规收集为结构化 JSON委托给子进程修复。包含配置保护钩子防止智能体修改检查器配置以通过检查而非修复代码。支持 Python、TypeScript、Shell、YAML、JSON、TOML、Markdown 和 Dockerfile。与 AgentShield 结合使用,实现安全 + 质量覆盖。完整集成指南请参阅 `skills/plankton-code-quality/`
### 🧠 持续学习 v2
基于本能的学习系统会自动学习您的模式:
@@ -559,8 +612,15 @@ cp -r everything-claude-code/rules/golang/* ~/.claude/rules/
# Copy commands
cp everything-claude-code/commands/*.md ~/.claude/commands/
# Copy skills
cp -r everything-claude-code/skills/* ~/.claude/skills/
# Copy skills (core vs niche)
# Recommended (new users): core/general skills only
cp -r everything-claude-code/.agents/skills/* ~/.claude/skills/
cp -r everything-claude-code/skills/search-first ~/.claude/skills/
# Optional: add niche/framework-specific skills only when needed
# for s in django-patterns django-tdd springboot-patterns; do
# cp -r everything-claude-code/skills/$s ~/.claude/skills/
# done
```
#### 将钩子添加到 settings.json
@@ -633,7 +693,7 @@ rules/
golang/ # Go specific patterns and tools
```
有关安装和结构详情,请参阅 [`rules/README.md`](../../rules/README.md)。
有关安装和结构详情,请参阅 [`rules/README.md`](rules/README.md)。
***
@@ -741,13 +801,14 @@ cp -r everything-claude-code/rules/common/* ~/.claude/rules/
</details>
<details>
<summary><b>Does this work with Cursor / OpenCode / Codex?</b></summary>
<summary><b>Does this work with Cursor / OpenCode / Codex / Antigravity?</b></summary>
是的。ECC 是跨平台的:
* **Cursor**`.cursor/` 中的预翻译配置。参见 [Cursor IDE 支持](#cursor-ide-支持)。
* **OpenCode**`.opencode/` 中的完整插件支持。参见 [OpenCode 支持](#-opencode-支持)。
* **Codex**提供适配器漂移护和 SessionStart 回退的一流支持。参见 PR [#257](https://github.com/affaan-m/everything-claude-code/pull/257)。
* **Cursor**`.cursor/` 中的预翻译配置。请参阅 [Cursor IDE 支持](#cursor-ide-支持)。
* **OpenCode**`.opencode/` 中的完整插件支持。请参阅 [OpenCode 支持](#-opencode-支持)。
* **Codex**对 macOS 应用和 CLI 的一流支持,带有适配器漂移护和 SessionStart 回退。请参阅 PR [#257](https://github.com/affaan-m/everything-claude-code/pull/257)。
* **Antigravity**`.agent/` 中针对工作流、技能和扁平化规则的紧密集成设置。
* **Claude Code**:原生支持 — 这是主要目标。
</details>
@@ -860,25 +921,32 @@ alwaysApply: false
***
## Codex CLI 支持
## Codex macOS 应用 + CLI 支持
ECC 提供**一流的 Codex CLI 支持**,包参考配置、Codex 特定的 AGENTS.md 补充和 16 个移植的技能。
ECC 为 macOS 应用和 CLI 提供 **一流的 Codex 支持**,包参考配置、Codex 特定的 AGENTS.md 补充文档以及共享技能。
### 快速开始Codex
### 快速开始Codex 应用 + CLI
```bash
# Copy the reference config to your home directory
cp .codex/config.toml ~/.codex/config.toml
# Run Codex in the repo — AGENTS.md is auto-detected
# Run Codex CLI in the repo — AGENTS.md is auto-detected
codex
```
Codex macOS 应用:
* 将此仓库作为您的工作区打开。
* 根目录的 `AGENTS.md` 会被自动检测。
* 参考 `.codex/config.toml` 故意不固定 `model``model_provider`,因此 Codex 会使用它自己的当前默认值,除非您显式覆盖。
* 可选:将 `.codex/config.toml` 复制到 `~/.codex/config.toml` 以实现 CLI/应用行为一致性。
### 包含内容
| 组件 | 数量 | 详情 |
|-----------|-------|---------|
| 配置 | 1 | `.codex/config.toml`模型、权限、MCP 服务器、持久指令 |
| 配置 | 1 | `.codex/config.toml` — 权限、MCP 服务器、通知和配置文件 |
| AGENTS.md | 2 | 根目录(通用)+ `.codex/AGENTS.md`Codex 特定补充) |
| 技能 | 16 | `.agents/skills/` — 每个技能包含 SKILL.md + agents/openai.yaml |
| MCP 服务器 | 4 | GitHub、Context7、Memory、Sequential Thinking基于命令 |
@@ -909,7 +977,7 @@ codex
### 关键限制
Codex CLI **尚不支持钩子**[GitHub Issue #2109](https://github.com/openai/codex/issues/2109)430+ 点赞)。安全强制执行是通过 `persistent_instructions` 中的指令和沙箱权限系统实现的
Codex **尚未提供 Claude 风格的钩子执行对等性**。ECC 在该平台上的强制执行是通过 `AGENTS.md` `persistent_instructions` 基于指令实现的,外加沙箱权限
***
@@ -933,12 +1001,12 @@ opencode
| 功能 | Claude Code | OpenCode | 状态 |
|---------|-------------|----------|--------|
| 代理 | ✅ 13代理 | ✅ 12 个代理 | **Claude Code 领先** |
| 命令 | ✅ 33 个命令 | ✅ 24 个命令 | **Claude Code 领先** |
| 技能 | ✅ 50+ 个技能 | ✅ 37 技能 | **Claude Code 领先** |
| 智能体 | ✅ 16智能体 | ✅ 12 个智能体 | **Claude Code 领先** |
| 命令 | ✅ 40 条命令 | ✅ 31 条命令 | **Claude Code 领先** |
| 技能 | ✅ 65 项技能 | ✅ 37 技能 | **Claude Code 领先** |
| 钩子 | ✅ 8 种事件类型 | ✅ 11 种事件 | **OpenCode 更多!** |
| 规则 | ✅ 29 条规则 | ✅ 13 条指令 | **Claude Code 领先** |
| MCP 服务器 | ✅ 14 个服务器 | ✅ 完整支持 | **完全对等** |
| MCP 服务器 | ✅ 14 个服务器 | ✅ 完整 | **完全对等** |
| 自定义工具 | ✅ 通过钩子 | ✅ 6 个原生工具 | **OpenCode 更好** |
### 通过插件实现的钩子支持
@@ -955,7 +1023,7 @@ OpenCode 的插件系统比 Claude Code 更复杂,有 20 多种事件类型:
**额外的 OpenCode 事件**`file.edited``file.watcher.updated``message.updated``lsp.client.diagnostics``tui.toast.show` 等等。
### 可用命令32个
### 可用命令31+
| 命令 | 描述 |
|---------|-------------|
@@ -965,7 +1033,7 @@ OpenCode 的插件系统比 Claude Code 更复杂,有 20 多种事件类型:
| `/build-fix` | 修复构建错误 |
| `/e2e` | 生成端到端测试 |
| `/refactor-clean` | 移除死代码 |
| `/orchestrate` | 多代理工作流 |
| `/orchestrate` | 多智能体工作流 |
| `/learn` | 从会话中提取模式 |
| `/checkpoint` | 保存验证状态 |
| `/verify` | 运行验证循环 |
@@ -976,7 +1044,7 @@ OpenCode 的插件系统比 Claude Code 更复杂,有 20 多种事件类型:
| `/go-review` | Go 代码审查 |
| `/go-test` | Go TDD 工作流 |
| `/go-build` | 修复 Go 构建错误 |
| `/python-review` | Python 代码审查PEP 8、类型提示、安全 |
| `/python-review` | Python 代码审查PEP 8、类型提示、安全 |
| `/multi-plan` | 多模型协作规划 |
| `/multi-execute` | 多模型协作执行 |
| `/multi-backend` | 后端聚焦的多模型工作流 |
@@ -989,8 +1057,15 @@ OpenCode 的插件系统比 Claude Code 更复杂,有 20 多种事件类型:
| `/instinct-import` | 导入本能 |
| `/instinct-export` | 导出本能 |
| `/evolve` | 将本能聚类为技能 |
| `/learn-eval` | 在保存前提取和评估模式 |
| `/promote` | 将项目本能提升到全局范围 |
| `/projects` | 列出已知项目和本能统计信息 |
| `/learn-eval` | 保存前提取和评估模式 |
| `/setup-pm` | 配置包管理器 |
| `/harness-audit` | 审计平台可靠性、评估准备情况和风险状况 |
| `/loop-start` | 启动受控的智能体循环执行模式 |
| `/loop-status` | 检查活动循环状态和检查点 |
| `/quality-gate` | 对路径或整个仓库运行质量门检查 |
| `/model-route` | 根据复杂度和预算将任务路由到模型 |
### 插件安装
@@ -1030,19 +1105,19 @@ ECC 是**第一个最大化利用每个主要 AI 编码工具的插件**。以
| 功能 | Claude Code | Cursor IDE | Codex CLI | OpenCode |
|---------|------------|------------|-----------|----------|
| **代理** | 13 | 共享 (AGENTS.md) | 共享 (AGENTS.md) | 12 |
| **命令** | 33 | 共享 | 基于指令 | 24 |
| **技能** | 50+ | 共享 | 10 (原生格式) | 37 |
| **钩子事件** | 8 种类型 | 15 种类型 | 无 | 11 种类型 |
| **钩子脚本** | 9 个脚本 | 16 个脚本 (DRY 适配器) | 不适用 | 插件钩子 |
| **规则** | 29 (通用 + 语言) | 29 (YAML 前言) | 基于指令 | 13 条指令 |
| **智能体** | 16 | 共享AGENTS.md | 共享AGENTS.md | 12 |
| **命令** | 40 | 共享 | 基于指令 | 31 |
| **技能** | 65 | 共享 | 10原生格式 | 37 |
| **钩子事件** | 8 种类型 | 15 种类型 | 无 | 11 种类型 |
| **钩子脚本** | 20+ 个脚本 | 16 个脚本DRY 适配器 | 不适用 | 插件钩子 |
| **规则** | 29通用 + 语言 | 29YAML 前言 | 基于指令 | 13 条指令 |
| **自定义工具** | 通过钩子 | 通过钩子 | 不适用 | 6 个原生工具 |
| **MCP 服务器** | 14 | 共享 (mcp.json) | 4 (基于命令) | 完整 |
| **MCP 服务器** | 14 | 共享mcp.json | 4基于命令 | 完整 |
| **配置格式** | settings.json | hooks.json + rules/ | config.toml | opencode.json |
| **上下文文件** | CLAUDE.md + AGENTS.md | AGENTS.md | AGENTS.md | AGENTS.md |
| **密检测** | 基于钩子 | beforeSubmitPrompt 钩子 | 基于沙箱 | 基于钩子 |
| **密检测** | 基于钩子 | beforeSubmitPrompt 钩子 | 基于沙箱 | 基于钩子 |
| **自动格式化** | PostToolUse 钩子 | afterFileEdit 钩子 | 不适用 | file.edited 钩子 |
| **版本** | 插件 | 插件 | 参考配置 | 1.6.0 |
| **版本** | 插件 | 插件 | 参考配置 | 1.8.0 |
**关键架构决策:**
@@ -1059,6 +1134,11 @@ ECC 是**第一个最大化利用每个主要 AI 编码工具的插件**。以
这些配置已在多个生产应用程序中经过实战测试。
## 灵感致谢
* 灵感来自 [zarazhangrui](https://github.com/zarazhangrui)
* homunculus 灵感来自 [humanplane](https://github.com/humanplane)
***
## 令牌优化
@@ -1167,7 +1247,7 @@ ECC 是**第一个最大化利用每个主要 AI 编码工具的插件**。以
这个项目是免费和开源的。赞助商帮助保持其维护和发展。
[**成为赞助商**](https://github.com/sponsors/affaan-m) | [赞助商等](SPONSORS.md)
[**成为赞助商**](https://github.com/sponsors/affaan-m) | [赞助](SPONSORS.md) | [赞助计划](SPONSORING.md)
***

43
docs/zh-CN/SPONSORING.md Normal file
View File

@@ -0,0 +1,43 @@
# 赞助 ECC
ECC 作为一个开源智能体性能测试系统,在 Claude Code、Cursor、OpenCode 和 Codex 应用程序/CLI 中得到维护。
## 为何赞助
赞助直接资助以下方面:
* 更快的错误修复和发布周期
* 跨测试平台的平台一致性工作
* 为社区免费提供的公共文档、技能和可靠性工具
## 赞助层级
这些是实用的起点,可以根据合作范围进行调整。
| 层级 | 价格 | 最适合 | 包含内容 |
|------|-------|----------|----------|
| 试点合作伙伴 | $200/月 | 首次赞助合作 | 月度指标更新、路线图预览、优先维护者反馈 |
| 成长合作伙伴 | $500/月 | 积极采用 ECC 的团队 | 试点权益 + 月度办公时间同步 + 工作流集成指导 |
| 战略合作伙伴 | $1,000+/月 | 平台/生态系统合作伙伴 | 成长权益 + 协调发布支持 + 更深入的维护者协作 |
## 赞助报告
每月分享的指标可能包括:
* npm 下载量(`ecc-universal``ecc-agentshield`
* 仓库采用情况(星标、分叉、贡献者)
* GitHub 应用安装趋势
* 发布节奏和可靠性里程碑
有关确切的命令片段和可重复的拉取流程,请参阅 [`docs/business/metrics-and-sponsorship.md`](../business/metrics-and-sponsorship.md)。
## 期望与范围
* 赞助支持维护和加速;不会转移项目所有权。
* 功能请求根据赞助层级、生态系统影响和维护风险进行优先级排序。
* 安全性和可靠性修复优先于全新功能。
## 在此赞助
* GitHub Sponsors: <https://github.com/sponsors/affaan-m>
* 项目网站: <https://ecc.tools>

View File

@@ -29,16 +29,28 @@
* **更好的支持** — 赞助者获得优先响应
* **影响路线图** — Pro+ 赞助者可以对功能进行投票
## 赞助者准备度信号
在赞助者对话中使用这些证明点:
* `ecc-universal``ecc-agentshield` 的实时 npm 安装/下载指标
* 通过 Marketplace 安装的 GitHub App 分发
* 公开采用信号:星标、分叉、贡献者、发布节奏
* 跨平台支持Claude Code、Cursor、OpenCode、Codex 应用/CLI
有关复制/粘贴指标拉取工作流程,请参阅 [`docs/business/metrics-and-sponsorship.md`](../business/metrics-and-sponsorship.md)。
## 赞助等级
| 级 | 价格 | 权益 |
| 级 | 价格 | 权益 |
|------|-------|----------|
| 支持者 | $5/月 | 名字出现在 README 中,早期访问 |
| 建者 | $10/月 | 高级工具访问权限 |
| 专业版 | $25/月 | 优先支持,办公时间咨询 |
| 团队 | $100/月 | 5个席位团队配置 |
| 商业 | $500/月 | 25个席位咨询额度 |
| 企业 | $2K/月 | 无限席位,定制工具 |
| 支持者 | 每月 $5 | 名字出现在 README 中,早期访问 |
| 建者 | 每月 $10 | 高级工具访问权限 |
| 专业版 | 每月 $25 | 优先支持,办公时间 |
| 团队 | 每月 $100 | 5 个席位,团队配置 |
| 平台合作伙伴 | 每月 $200 | 月度路线图同步,优先维护者反馈,发布说明提及 |
| 商业版 | 每月 $500 | 25 个席位,咨询积分 |
| 企业版 | 每月 $2K | 无限制席位,自定义工具 |
[**Become a Sponsor →**](https://github.com/sponsors/affaan-m)

View File

@@ -150,6 +150,6 @@ claude /schedule-reply "Reply to Sarah about the board meeting"
## 先决条件
* [Claude Code](https://docs.anthropic.com/en/docs/claude-code)
* Gmail CLI (例如 [gog](https://gog by @pterm))
* Node.js 18+ (用于 calendar-suggest.js)
* 可选Slack MCP 服务器、Matrix 桥接 (LINE)、Chrome + Playwright (Messenger)
* Gmail CLI(例如,@pterm 的 gog
* Node.js 18+用于 calendar-suggest.js
* 可选Slack MCP 服务器、Matrix 桥接LINE、Chrome + PlaywrightMessenger

View File

@@ -222,3 +222,17 @@ Verdict: WARNING — 2 HIGH issues should be resolved before merge.
* 状态管理约定Zustand、Redux、Context
根据项目已建立的模式调整你的审查。如有疑问,与代码库的其余部分保持一致。
## v1.8 AI 生成代码审查附录
在审查 AI 生成的更改时,请优先考虑:
1. 行为回归和边缘情况处理
2. 安全假设和信任边界
3. 隐藏的耦合或意外的架构漂移
4. 不必要的增加模型成本的复杂性
成本意识检查:
* 标记那些在没有明确理由需求的情况下升级到更高成本模型的工作流程。
* 建议对于确定性的重构,默认使用较低成本的层级。

View File

@@ -7,7 +7,7 @@ model: sonnet
# 数据库审查员
您是一位专注于查询优化、模式设计、安全性和性能的 PostgreSQL 数据库专家。您的任务是确保数据库代码遵循最佳实践防止性能问题并保持数据完整性。融[Supabase 的 postgres-best-practices](Supabase Agent Skills (credit: Supabase team)) 中的模式。
您是一位专注于查询优化、模式设计、安全性和性能的 PostgreSQL 数据库专家。您的使命是确保数据库代码遵循最佳实践防止性能问题,并维护数据完整性。融了 Supabase 的 postgres-best-practices 中的模式致谢Supabase 团队)
## 核心职责
@@ -91,4 +91,4 @@ psql -c "SELECT indexrelname, idx_scan, idx_tup_read FROM pg_stat_user_indexes O
**请记住**:数据库问题通常是应用程序性能问题的根本原因。尽早优化查询和模式设计。使用 EXPLAIN ANALYZE 来验证假设。始终对外键和 RLS 策略列建立索引。
*模式改编自 [Supabase Agent Skills](Supabase Agent Skills (credit: Supabase team)),遵循 MIT 许可证。*
*模式改编自 Supabase Agent Skills(致谢:Supabase 团队),遵循 MIT 许可证。*

View File

@@ -0,0 +1,35 @@
---
name: harness-optimizer
description: 分析并改进本地代理工具配置以提高可靠性、降低成本并增加吞吐量。
tools: ["Read", "Grep", "Glob", "Bash", "Edit"]
model: sonnet
color: teal
---
你是线束优化器。
## 使命
通过改进线束配置来提升智能体完成质量,而不是重写产品代码。
## 工作流程
1. 运行 `/harness-audit` 并收集基准分数。
2. 确定前 3 个高杠杆领域(钩子、评估、路由、上下文、安全性)。
3. 提出最小化、可逆的配置更改。
4. 应用更改并运行验证。
5. 报告前后差异。
## 约束
* 优先选择效果可衡量的小改动。
* 保持跨平台行为。
* 避免引入脆弱的 shell 引用。
* 保持与 Claude Code、Cursor、OpenCode 和 Codex 的兼容性。
## 输出
* 基准记分卡
* 应用的更改
* 测量的改进
* 剩余风险

View File

@@ -0,0 +1,37 @@
---
name: loop-operator
description: 操作自主代理循环,监控进度,并在循环停滞时安全地进行干预。
tools: ["Read", "Grep", "Glob", "Bash", "Edit"]
model: sonnet
color: orange
---
你是循环操作员。
## 任务
安全地运行自主循环,具备明确的停止条件、可观测性和恢复操作。
## 工作流程
1. 从明确的模式和模式开始循环。
2. 跟踪进度检查点。
3. 检测停滞和重试风暴。
4. 当故障重复出现时,暂停并缩小范围。
5. 仅在验证通过后恢复。
## 必要检查
* 质量门处于活动状态
* 评估基线存在
* 回滚路径存在
* 分支/工作树隔离已配置
## 升级
当任何条件为真时升级:
* 连续两个检查点没有进展
* 具有相同堆栈跟踪的重复故障
* 成本漂移超出预算窗口
* 合并冲突阻塞队列前进

View File

@@ -83,3 +83,14 @@ npm run test:coverage
* \[ ] 覆盖率在 80% 以上
有关详细的模拟模式和特定框架示例,请参阅 `skill: tdd-workflow`
## v1.8 评估驱动型 TDD 附录
将评估驱动开发集成到 TDD 流程中:
1. 在实现之前,定义能力评估和回归评估。
2. 运行基线测试并捕获失败特征。
3. 实施能通过测试的最小变更。
4. 重新运行测试和评估;报告 pass@1 和 pass@3 结果。
发布关键路径在合并前应达到 pass@3 的稳定性目标。

View File

@@ -1,10 +1,10 @@
---
description: 启动 NanoClaw 代理 REPL —— 一个由 claude CLI 驱动的持久、会话感知的 AI 助手
description: 启动 NanoClaw v2 — ECC 的持久、零依赖 REPL具备模型路由、技能热加载、分支、压缩、导出和指标功能
---
# Claw 命令
启动一个交互式 AI 代理会话,该会话将会话历史持久化到磁盘,并可选择加载 ECC 技能上下文
启动一个具有持久化 Markdown 历史记录和操作控制的交互式 AI 代理会话。
## 使用方法
@@ -23,57 +23,29 @@ npm run claw
| 变量 | 默认值 | 描述 |
|----------|---------|-------------|
| `CLAW_SESSION` | `default` | 会话名称(字母数字 + 连字符) |
| `CLAW_SKILLS` | *(空)* | 要加载为系统上下文的技能名称,以逗号分隔 |
| `CLAW_SKILLS` | *(空)* | 启动时加载的以逗号分隔的技能列表 |
| `CLAW_MODEL` | `sonnet` | 会话的默认模型 |
## REPL 命令
在 REPL 内部,直接在提示符下输入这些命令:
```
/clear Clear current session history
/history Print full conversation history
/sessions List all saved sessions
/help Show available commands
exit Quit the REPL
```text
/help Show help
/clear Clear current session history
/history Print full conversation history
/sessions List saved sessions
/model [name] Show/set model
/load <skill-name> Hot-load a skill into context
/branch <session-name> Branch current session
/search <query> Search query across sessions
/compact Compact old turns, keep recent context
/export <md|json|txt> [path] Export session
/metrics Show session metrics
exit Quit
```
## 工作原理
## 说明
1. 读取 `CLAW_SESSION` 环境变量以选择命名会话(默认:`default`
2. `~/.claude/claw/{session}.md` 加载会话历史
3. 可选地从 `CLAW_SKILLS` 环境变量加载 ECC 技能上下文
4. 进入一个阻塞式提示循环 —— 每条用户消息都会连同完整历史记录发送到 `claude -p`
5. 响应会被追加到会话文件中,以便在重启后保持持久性
## 会话存储
会话以 Markdown 文件形式存储在 `~/.claude/claw/` 中:
```
~/.claude/claw/default.md
~/.claude/claw/my-project.md
```
每一轮对话的格式如下:
```markdown
### [2025-01-15T10:30:00.000Z] 用户
这个函数是做什么的?
---
### [2025-01-15T10:30:05.000Z] 助手
这个函数用于计算...
---
```
## 示例
```bash
# Start default session
node scripts/claw.js
# Named session
CLAW_SESSION=my-project node scripts/claw.js
# With skill context
CLAW_SKILLS=tdd-workflow,security-review node scripts/claw.js
```
* NanoClaw 保持零依赖。
* 会话存储在 `~/.claude/claw/<session>.md`
* 压缩会保留最近的回合并写入压缩头。
* 导出支持 Markdown、JSON 回合和纯文本。

View File

@@ -1,6 +1,6 @@
---
name: evolve
description: 将相关本能聚类为技能、命令或代理
description: 分析本能并建议或生成进化结构
command: true
---
@@ -30,9 +30,7 @@ python3 ~/.claude/skills/continuous-learning-v2/scripts/instinct-cli.py evolve [
```
/evolve # Analyze all instincts and suggest evolutions
/evolve --domain testing # Only evolve instincts in testing domain
/evolve --dry-run # Show what would be created without creating
/evolve --threshold 5 # Require 5+ related instincts to cluster
/evolve --generate # Also generate files under evolved/{skills,commands,agents}
```
## 演化规则
@@ -88,63 +86,50 @@ python3 ~/.claude/skills/continuous-learning-v2/scripts/instinct-cli.py evolve [
## 操作步骤
1. `~/.claude/homunculus/instincts/` 读取所有本能
2. 按以下方式对本能进行分组:
* 领域相似性
* 触发器模式重叠
* 操作序列关联性
3. 对于每个包含 3 个以上相关本能的集群:
* 确定演化类型(命令/技能/代理
* 生成相应的文件
* 保存到 `~/.claude/homunculus/evolved/{commands,skills,agents}/`
4. 将演化后的结构链接回源本能
1. 检测当前项目上下文
2. 读取项目 + 全局本能(项目优先级高于 ID 冲突)
3. 按触发器/领域模式分组本能
4. 识别:
* 技能候选(包含 2+ 个本能的触发器簇)
* 命令候选(高置信度工作流本能)
* 智能体候选(更大、高置信度的簇
5. 在适用时显示升级候选(项目 -> 全局)
6. 如果传入了 `--generate`,则将文件写入:
* 项目范围:`~/.claude/homunculus/projects/<project-id>/evolved/`
* 全局回退:`~/.claude/homunculus/evolved/`
## 输出格式
```
🧬 Evolve Analysis
==================
============================================================
EVOLVE ANALYSIS - 12 instincts
Project: my-app (a1b2c3d4e5f6)
Project-scoped: 8 | Global: 4
============================================================
Found 3 clusters ready for evolution:
High confidence instincts (>=80%): 5
## Cluster 1: Database Migration Workflow
Instincts: new-table-migration, update-schema, regenerate-types
Type: Command
Confidence: 85% (based on 12 observations)
## SKILL CANDIDATES
1. Cluster: "adding tests"
Instincts: 3
Avg confidence: 82%
Domains: testing
Scopes: project
Would create: /new-table command
Files:
- ~/.claude/homunculus/evolved/commands/new-table.md
## COMMAND CANDIDATES (2)
/adding-tests
From: test-first-workflow [project]
Confidence: 84%
## Cluster 2: Functional Code Style
Instincts: prefer-functional, use-immutable, avoid-classes, pure-functions
Type: Skill
Confidence: 78% (based on 8 observations)
Would create: functional-patterns skill
Files:
- ~/.claude/homunculus/evolved/skills/functional-patterns.md
## Cluster 3: Debugging Process
Instincts: debug-check-logs, debug-isolate, debug-reproduce, debug-verify
Type: Agent
Confidence: 72% (based on 6 observations)
Would create: debugger agent
Files:
- ~/.claude/homunculus/evolved/agents/debugger.md
---
Run `/evolve --execute` to create these files.
## AGENT CANDIDATES (1)
adding-tests-agent
Covers 3 instincts
Avg confidence: 82%
```
## 标志
* `--execute`: 实际创建演化后的结构(默认为预览)
* `--dry-run`: 仅预览而不创建
* `--domain <name>`: 仅演化指定领域的本能
* `--threshold <n>`: 形成集群所需的最小本能数默认3
* `--type <command|skill|agent>`: 仅创建指定类型
* `--generate`:除了分析输出外,还生成进化后的文件
## 生成的文件格式

View File

@@ -0,0 +1,59 @@
# 工具链审计命令
审计当前代码库的智能体工具链设置并返回一份优先级评分卡。
## 使用方式
`/harness-audit [scope] [--format text|json]`
* `scope` (可选): `repo` (默认), `hooks`, `skills`, `commands`, `agents`
* `--format`: 输出样式 (`text` 默认, `json` 用于自动化)
## 评估内容
将每个类别从 `0``10` 进行评分:
1. 工具覆盖度
2. 上下文效率
3. 质量门禁
4. 记忆持久化
5. 评估覆盖度
6. 安全护栏
7. 成本效率
## 输出约定
返回:
1. `overall_score` (满分 70)
2. 类别得分和具体发现
3. 前 3 项待办事项及其确切文件路径
4. 建议接下来应用的 ECC 技能
## 检查清单
* 检查 `hooks/hooks.json`, `scripts/hooks/` 以及钩子测试。
* 检查 `skills/`、命令覆盖度和智能体覆盖度。
* 验证 `.cursor/`, `.opencode/`, `.codex/` 在跨工具链间的一致性。
* 标记已损坏或过时的引用。
## 结果示例
```text
Harness Audit (repo): 52/70
- Quality Gates: 9/10
- Eval Coverage: 6/10
- Cost Efficiency: 4/10
Top 3 Actions:
1) Add cost tracking hook in scripts/hooks/cost-tracker.js
2) Add pass@k docs and templates in skills/eval-harness/SKILL.md
3) Add command parity for /harness-audit in .opencode/commands/
```
## 参数
$ARGUMENTS:
* `repo|hooks|skills|commands|agents` (可选范围)
* `--format text|json` (可选输出格式)

View File

@@ -1,6 +1,6 @@
---
name: instinct-export
description: 导出本能,与团队成员或其他项目共享
description: 将项目/全局范围的本能导出到文件
command: /instinct-export
---
@@ -19,17 +19,18 @@ command: /instinct-export
/instinct-export --domain testing # Export only testing instincts
/instinct-export --min-confidence 0.7 # Only export high-confidence instincts
/instinct-export --output team-instincts.yaml
/instinct-export --scope project --output project-instincts.yaml
```
## 操作步骤
1. `~/.claude/homunculus/instincts/personal/` 读取本能
2. 根据标志进行筛选
3. 剥离敏感信息:
* 移除会话 ID
* 移除文件路径(仅保留模式
* 移除早于“上周”的时间戳
4. 生成导出文件
1. 检测当前项目上下文
2. 按选定范围加载本能:
* `project`: 仅限当前项目
* `global`: 仅限全局
* `all`: 项目与全局合并(默认
3. 应用过滤器(`--domain`, `--min-confidence`
4. 将 YAML 格式的导出写入文件(如果未提供输出路径,则写入标准输出)
## 输出格式
@@ -41,54 +42,26 @@ command: /instinct-export
# Source: personal
# Count: 12 instincts
version: "2.0"
exported_by: "continuous-learning-v2"
export_date: "2025-01-22T10:30:00Z"
---
id: prefer-functional-style
trigger: "when writing new functions"
confidence: 0.8
domain: code-style
source: session-observation
scope: project
project_id: a1b2c3d4e5f6
project_name: my-app
---
instincts:
- id: prefer-functional-style
trigger: "when writing new functions"
action: "Use functional patterns over classes"
confidence: 0.8
domain: code-style
observations: 8
# Prefer Functional Style
- id: test-first-workflow
trigger: "when adding new functionality"
action: "Write test first, then implementation"
confidence: 0.9
domain: testing
observations: 12
- id: grep-before-edit
trigger: "when modifying code"
action: "Search with Grep, confirm with Read, then Edit"
confidence: 0.7
domain: workflow
observations: 6
## Action
Use functional patterns over classes.
```
## 隐私考虑
导出内容包括:
* ✅ 触发模式
* ✅ 操作
* ✅ 置信度分数
* ✅ 领域
* ✅ 观察计数
导出内容不包括:
* ❌ 实际代码片段
* ❌ 文件路径
* ❌ 会话记录
* ❌ 个人标识符
## 标志
* `--domain <name>`仅导出指定领域
* `--min-confidence <n>`最低置信度阈值默认0.3
* `--output <file>`输出文件路径(默认instincts-export-YYYYMMDD.yaml
* `--format <yaml|json|md>`输出格式默认yaml
* `--include-evidence`:包含证据文本(默认:排除)
* `--domain <name>`: 仅导出指定领域
* `--min-confidence <n>`: 最低置信度阈值
* `--output <file>`: 输出文件路径(省略时打印到标准输出
* `--scope <project|global|all>`: 导出范围(默认:`all`

View File

@@ -1,6 +1,6 @@
---
name: instinct-import
description: 从队友、技能创建者或其他来源导入本能
description: 从文件或URL导入本能到项目/全局作用域
command: true
---
@@ -11,7 +11,7 @@ command: true
使用插件根路径运行本能 CLI
```bash
python3 "${CLAUDE_PLUGIN_ROOT}/skills/continuous-learning-v2/scripts/instinct-cli.py" import <file-or-url> [--dry-run] [--force] [--min-confidence 0.7]
python3 "${CLAUDE_PLUGIN_ROOT}/skills/continuous-learning-v2/scripts/instinct-cli.py" import <file-or-url> [--dry-run] [--force] [--min-confidence 0.7] [--scope project|global]
```
或者,如果 `CLAUDE_PLUGIN_ROOT` 未设置(手动安装):
@@ -20,19 +20,15 @@ python3 "${CLAUDE_PLUGIN_ROOT}/skills/continuous-learning-v2/scripts/instinct-cl
python3 ~/.claude/skills/continuous-learning-v2/scripts/instinct-cli.py import <file-or-url>
```
以下来源导入本能
* 队友的导出
* 技能创建器(仓库分析)
* 社区集合
* 之前的机器备份
本地文件路径或 HTTP(S) URL 导入本能
## 用法
```
/instinct-import team-instincts.yaml
/instinct-import https://github.com/org/repo/instincts.yaml
/instinct-import --from-skill-creator acme/webapp
/instinct-import team-instincts.yaml --dry-run
/instinct-import team-instincts.yaml --scope global --force
```
## 执行步骤
@@ -41,7 +37,9 @@ python3 ~/.claude/skills/continuous-learning-v2/scripts/instinct-cli.py import <
2. 解析并验证格式
3. 检查与现有本能的重复项
4. 合并或添加新本能
5. 保存到 `~/.claude/homunculus/instincts/inherited/`
5. 保存到继承的本能目录:
* 项目范围:`~/.claude/homunculus/projects/<project-id>/instincts/inherited/`
* 全局范围:`~/.claude/homunculus/instincts/inherited/`
## 导入过程
@@ -72,66 +70,35 @@ Already have similar instincts:
Import: 0.9 confidence
→ Update to import (higher confidence)
## Conflicting Instincts (1)
These contradict local instincts:
❌ use-classes-for-services
Conflicts with: avoid-classes
→ Skip (requires manual resolution)
---
Import 8 new, update 1, skip 3?
Import 8 new, update 1?
```
## 合并策略
## 合并行为
### 针对重复项
当导入一个已存在 ID 的本能时:
当导入一个与现有本能匹配的本能时:
* **置信度高的胜出**:保留置信度更高的那个
* **合并证据**:合并观察计数
* **更新时间戳**:标记为最近已验证
### 针对冲突
当导入一个与现有本能相矛盾的本能时:
* **默认跳过**:不导入冲突的本能
* **标记待审**:将两者都标记为需要注意
* **手动解决**:由用户决定保留哪个
* 置信度更高的导入会成为更新候选
* 置信度相等或更低的导入将被跳过
* 除非使用 `--force`,否则需要用户确认
## 来源追踪
导入的本能被标记为:
```yaml
source: "inherited"
source: inherited
scope: project
imported_from: "team-instincts.yaml"
imported_at: "2025-01-22T10:30:00Z"
original_source: "session-observation" # or "repo-analysis"
project_id: "a1b2c3d4e5f6"
project_name: "my-project"
```
## 技能创建器集成
从技能创建器导入时:
```
/instinct-import --from-skill-creator acme/webapp
```
这会获取从仓库分析生成的本能:
* 来源:`repo-analysis`
* 更高的初始置信度0.7+
* 链接到源仓库
## 标志
* `--dry-run`:预览而不导入
* `--force`即使存在冲突也导入
* `--merge-strategy <higher|local|import>`:如何处理重复项
* `--from-skill-creator <owner/repo>`:从技能创建器分析导入
* `--dry-run`预览而不导入
* `--force`跳过确认提示
* `--min-confidence <n>`:仅导入高于阈值的本能
* `--scope <project|global>`:选择目标范围(默认:`project`
## 输出
@@ -142,7 +109,7 @@ original_source: "session-observation" # or "repo-analysis"
Added: 8 instincts
Updated: 1 instinct
Skipped: 3 instincts (2 duplicates, 1 conflict)
Skipped: 3 instincts (equal/higher confidence already exists)
New instincts saved to: ~/.claude/homunculus/instincts/inherited/

View File

@@ -1,12 +1,12 @@
---
name: instinct-status
description: 显示所有已学习的本能及其置信水平
description: 展示已学习的本能(项目+全局)并充满信心
command: true
---
# 本能状态命令
显示所有已学习的本能及其置信度分数,按领域分组。
显示当前项目学习的本能以及全局本能,按领域分组。
## 实现
@@ -26,61 +26,34 @@ python3 ~/.claude/skills/continuous-learning-v2/scripts/instinct-cli.py status
```
/instinct-status
/instinct-status --domain code-style
/instinct-status --low-confidence
```
## 操作步骤
1. `~/.claude/homunculus/instincts/personal/` 读取所有本能文件
2.`~/.claude/homunculus/instincts/inherited/` 读取继承的本能
3. 按领域分组显示它们,并带有置信度条
1. 检测当前项目上下文git remote/路径哈希)
2.`~/.claude/homunculus/projects/<project-id>/instincts/` 读取项目本能
3. `~/.claude/homunculus/instincts/` 读取全局本能
4. 合并并应用优先级规则当ID冲突时项目本能覆盖全局本能
5. 按领域分组显示,包含置信度条和观察统计数据
## 输出格式
```
📊 Instinct Status
==================
============================================================
INSTINCT STATUS - 12 total
============================================================
## Code Style (4 instincts)
Project: my-app (a1b2c3d4e5f6)
Project instincts: 8
Global instincts: 4
### prefer-functional-style
Trigger: when writing new functions
Action: Use functional patterns over classes
Confidence: ████████░░ 80%
Source: session-observation | Last updated: 2025-01-22
## PROJECT-SCOPED (my-app)
### WORKFLOW (3)
███████░░░ 70% grep-before-edit [project]
trigger: when modifying code
### use-path-aliases
Trigger: when importing modules
Action: Use @/ path aliases instead of relative imports
Confidence: ██████░░░░ 60%
Source: repo-analysis (github.com/acme/webapp)
## Testing (2 instincts)
### test-first-workflow
Trigger: when adding new functionality
Action: Write test first, then implementation
Confidence: █████████░ 90%
Source: session-observation
## Workflow (3 instincts)
### grep-before-edit
Trigger: when modifying code
Action: Search with Grep, confirm with Read, then Edit
Confidence: ███████░░░ 70%
Source: session-observation
---
Total: 9 instincts (4 personal, 5 inherited)
Observer: Running (last analysis: 5 min ago)
## GLOBAL (apply to all projects)
### SECURITY (2)
█████████░ 85% validate-user-input [global]
trigger: when handling user input
```
## 标志
* `--domain <name>`按领域过滤code-style、testing、git 等)
* `--low-confidence`:仅显示置信度 < 0.5 的本能
* `--high-confidence`:仅显示置信度 >= 0.7 的本能
* `--source <type>`按来源过滤session-observation、repo-analysis、inherited
* `--json`:以 JSON 格式输出,供编程使用

View File

@@ -0,0 +1,33 @@
# 循环启动命令
使用安全默认设置启动一个受管理的自主循环模式。
## 用法
`/loop-start [pattern] [--mode safe|fast]`
* `pattern`: `sequential`, `continuous-pr`, `rfc-dag`, `infinite`
* `--mode`:
* `safe` (默认): 严格的质量门禁和检查点
* `fast`: 为速度而减少门禁
## 流程
1. 确认仓库状态和分支策略。
2. 选择循环模式和模型层级策略。
3. 为所选模式启用所需的钩子/配置文件。
4. 创建循环计划并在 `.claude/plans/` 下编写运行手册。
5. 打印用于启动和监控循环的命令。
## 必需的安全检查
* 在首次循环迭代前验证测试通过。
* 确保 `ECC_HOOK_PROFILE` 未在全局范围内被禁用。
* 确保循环有明确的停止条件。
## 参数
$ARGUMENTS:
* `<pattern>` 可选 (`sequential|continuous-pr|rfc-dag|infinite`)
* `--mode safe|fast` 可选

View File

@@ -0,0 +1,25 @@
# 循环状态命令
检查活动循环状态、进度和故障信号。
## 用法
`/loop-status [--watch]`
## 报告内容
* 活动循环模式
* 当前阶段和最后一个成功的检查点
* 失败的检查(如果有)
* 预计的时间/成本偏差
* 建议的干预措施(继续/暂停/停止)
## 监视模式
`--watch` 存在时,定期刷新状态并显示状态变化。
## 参数
$ARGUMENTS:
* `--watch` 可选

View File

@@ -0,0 +1,27 @@
# 模型路由命令
根据任务复杂度和预算推荐最佳模型层级。
## 用法
`/model-route [task-description] [--budget low|med|high]`
## 路由启发式规则
* `haiku`: 确定性、低风险的机械性变更
* `sonnet`: 实现和重构的默认选择
* `opus`: 架构设计、深度评审、模糊需求
## 必需输出
* 推荐的模型
* 置信度
* 该模型适合的原因
* 如果首次尝试失败,备用的回退模型
## 参数
$ARGUMENTS:
* `[task-description]` 可选,自由文本
* `--budget low|med|high` 可选

View File

@@ -86,13 +86,13 @@ EOF",
### 阶段 0提示词增强可选
`[Mode: Prepare]` - 如果 ace-tool MCP 可用,调用 `mcp__ace-tool__enhance_prompt`**用增强后的结果替换原始的 $ARGUMENTS用于后续的 Codex 调用**。不可用时,直接使用 `$ARGUMENTS`
`[Mode: Prepare]` - 如果 ace-tool MCP 可用,调用 `mcp__ace-tool__enhance_prompt`**原始的 $ARGUMENTS 替换为增强后的结果,用于后续的 Codex 调用**。如果不可用,则按原样使用 `$ARGUMENTS`
### 阶段 1研究
`[Mode: Research]` - 理解需求并收集上下文
1. **代码检索**(如果 ace-tool MCP 可用):调用 `mcp__ace-tool__search_context` 检索现有的 API、数据模型、服务架构。不可用,使用内置工具:`Glob` 进行文件发现,`Grep` 进行符号/API 搜索,`Read` 进行上下文收集,`Task`Explore 代理)进行更深入的探索。
1. **代码检索**(如果 ace-tool MCP 可用):调用 `mcp__ace-tool__search_context` 检索现有的 API、数据模型、服务架构。如果不可用,使用内置工具:`Glob` 用于文件发现,`Grep` 用于符号/API 搜索,`Read` 用于上下文收集,`Task`探索代理)用于更深入的探索。
2. 需求完整性评分0-10>=7 继续,<7 停止并补充
### 阶段 2构思

View File

@@ -140,26 +140,27 @@ TaskOutput({ task_id: "<task_id>", block: true, timeout: 600000 })
**如果 ace-tool MCP 可用**,使用它进行快速上下文检索:
基于计划中的关键文件”列表,调用 `mcp__ace-tool__search_context`
基于计划中的关键文件”列表,调用 `mcp__ace-tool__search_context`
```
mcp__ace-tool__search_context({
query: <semantic query based on plan content, including key files, modules, function names>,
project_root_path: $PWD
query: "<semantic query based on plan content, including key files, modules, function names>",
project_root_path: "$PWD"
})
```
**检索策略**
* 从计划的关键文件”表中提取目标路径
* 构建语义查询盖:入口文件、依赖模块、相关类型定义
* 从计划的关键文件”表中提取目标路径
* 构建语义查询,涵盖:入口文件、依赖模块、相关类型定义
* 如果结果不足,添加 1-2 次递归检索
**如果 ace-tool MCP 不可用**,使用 Claude Code 内置工具作为回退
1. **Glob**:从计划的”关键文件”表中查找目标文件(例如 `Glob(“src/components/**/*.tsx”)`
**如果 ace-tool MCP 不可用**,使用 Claude Code 内置工具作为后备方案
1. **Glob**:从计划的“关键文件”表中查找目标文件(例如,`Glob("src/components/**/*.tsx")`
2. **Grep**:在代码库中搜索关键符号、函数名、类型定义
3. **Read**:读取发现的文件以收集完整上下文
4. **TaskExplore 代理**如需更广泛的探索,使用 `Task` 并设置 `subagent_type: Explore`
3. **Read**:读取发现的文件以收集完整上下文
4. **Task (探索代理)**对于更广泛的探索,使用 `Task` `subagent_type: "Explore"`
**检索后**

View File

@@ -86,14 +86,14 @@ EOF",
### 阶段 0: 提示词增强(可选)
`[Mode: Prepare]` - 如果 ace-tool MCP 可用,调用 `mcp__ace-tool__enhance_prompt`**原始的 $ARGUMENTS 替换为增强后的结果,用于后续 Gemini 调用**。不可用时,直接使用 `$ARGUMENTS`
`[Mode: Prepare]` - 如果 ace-tool MCP 可用,调用 `mcp__ace-tool__enhance_prompt`**用增强后的结果替换原始的 $ARGUMENTS,供后续 Gemini 调用使用**。如果不可用,则按原样使用 `$ARGUMENTS`
### 阶段 1: 研究
`[Mode: Research]` - 理解需求并收集上下文
1. **代码检索**(如果 ace-tool MCP 可用): 调用 `mcp__ace-tool__search_context` 来检索现有的组件、样式、设计系统。不可用,使用内置工具:`Glob` 进行文件发现,`Grep` 进行组件/样式搜索,`Read` 进行上下文收集,`Task`Explore 代理)进行更深入的探索。
2. 需求完整性评分0-10: >=7 继续,<7 停止并补充
1. **代码检索**(如果 ace-tool MCP 可用)调用 `mcp__ace-tool__search_context` 来检索现有的组件、样式、设计系统。如果不可用,使用内置工具:`Glob` 用于文件发现,`Grep` 用于组件/样式搜索,`Read` 用于上下文收集,`Task`探索代理)用于更深层次的探索。
2. 需求完整性评分0-10分):>=7 继续,<7 停止并补充
### 阶段 2: 构思

View File

@@ -85,7 +85,7 @@ mcp__ace-tool__enhance_prompt({
等待增强后的提示,**将所有后续阶段的原始 $ARGUMENTS 替换为增强结果**。
**如果 ace-tool MCP 不可用**:跳过此步骤,在所有后续阶段直接使用原始 `$ARGUMENTS`
**如果 ace-tool MCP 不可用**:跳过此步骤,在所有后续阶段直接使用原始 `$ARGUMENTS`
#### 1.2 上下文检索
@@ -98,14 +98,15 @@ mcp__ace-tool__search_context({
})
```
* 使用自然语言构建语义查询(Where/What/How
* **绝不基于假设回答**
* 使用自然语言构建语义查询(在哪里/是什么/怎么样
* **切勿基于假设回答**
**如果 ace-tool MCP 不可用**,使用 Claude Code 内置工具作为回退
1. **Glob**:按模式查找相关文件(例如 `Glob("**/*.ts")``Glob("src/**/*.py")`
2. **Grep**搜索关键符号、函数名、类定义(例如 `Grep("className|functionName")`
3. **Read**读取发现的文件以收集完整上下文
4. **TaskExplore 代理)**:如需更深入的探索,使用 `Task` 并设置 `subagent_type: "Explore"`
**如果 ace-tool MCP 不可用**,使用 Claude Code 内置工具作为备用方案
1. **Glob**通过模式查找相关文件(例如`Glob("**/*.ts")``Glob("src/**/*.py")`
2. **Grep**搜索关键符号、函数名、类定义(例如,`Grep("className|functionName")`
3. **Read**:读取发现的文件以收集完整的上下文
4. **Task (Explore agent)**:要进行更深入的探索,使用 `Task` 并配合 `subagent_type: "Explore"` 来搜索整个代码库
#### 1.3 完整性检查

View File

@@ -13,9 +13,9 @@
## 上下文
* 待开发任务:$ARGUMENTS
* 结构化的 6 阶段工作流程,包含质量门控
* 结构化的 6 阶段工作流程,带有质量关卡
* 多模型协作Codex后端 + Gemini前端 + Claude编排
* MCP 服务集成ace-tool可选以增强能力
* 集成 MCP 服务ace-tool可选以增强能力
## 你的角色
@@ -23,8 +23,8 @@
**协作模型**
* **ace-tool MCP**(可选) 代码检索 + 提示增强
* **Codex** 后端逻辑、算法、调试(**后端权威,信赖**
* **ace-tool MCP**(可选) 代码检索 + 提示增强
* **Codex** 后端逻辑、算法、调试(**后端权威,值得信赖**
* **Gemini** 前端 UI/UX、视觉设计**前端专家,后端意见仅供参考**
* **Claude自身** 编排、规划、执行、交付
@@ -114,11 +114,11 @@ TaskOutput({ task_id: "<task_id>", block: true, timeout: 600000 })
`[Mode: Research]` - 理解需求并收集上下文:
1. **提示增强**(如果 ace-tool MCP 可用):调用 `mcp__ace-tool__enhance_prompt`**所有后续 Codex/Gemini 调用中的原始 $ARGUMENTS 替换为增强后的结果**。不可用,直接使用 `$ARGUMENTS`
2. **上下文检索**(如果 ace-tool MCP 可用):调用 `mcp__ace-tool__search_context`。不可用,使用内置工具:`Glob` 进行文件发现,`Grep` 进行符号搜索,`Read` 进行上下文收集,`Task`Explore 代理)进行更深入的探索。
3. **需求完整性评分** (0-10)
* 目标清晰度 (0-3),预期成果 (0-3)范围边界 (0-2)约束条件 (0-2)
* ≥7继续 | <7停止询问澄清问题
1. **提示增强**(如果 ace-tool MCP 可用):调用 `mcp__ace-tool__enhance_prompt`**用增强后的结果替换原始的 $ARGUMENTS用于所有后续 Codex/Gemini 调用**。如果不可用,直接使用 `$ARGUMENTS`
2. **上下文检索**(如果 ace-tool MCP 可用):调用 `mcp__ace-tool__search_context`如果不可用,使用内置工具:`Glob` 用于文件发现,`Grep` 用于符号搜索,`Read` 用于上下文收集,`Task`探索代理)用于更深入的探索。
3. **需求完整性评分**0-10
* 目标清晰度0-3)、预期结果(0-3)、范围边界0-2)、约束条件0-2
* ≥7继续 | <7停止询问澄清问题
### 阶段 2解决方案构思

View File

@@ -0,0 +1,39 @@
---
name: projects
description: 列出已知项目及其本能统计数据
command: true
---
# 项目命令
列出项目注册条目以及每个项目的本能/观察计数,适用于 continuous-learning-v2。
## 实现
使用插件根路径运行本能 CLI
```bash
python3 "${CLAUDE_PLUGIN_ROOT}/skills/continuous-learning-v2/scripts/instinct-cli.py" projects
```
或者如果 `CLAUDE_PLUGIN_ROOT` 未设置(手动安装):
```bash
python3 ~/.claude/skills/continuous-learning-v2/scripts/instinct-cli.py projects
```
## 用法
```bash
/projects
```
## 操作步骤
1. 读取 `~/.claude/homunculus/projects.json`
2. 对于每个项目,显示:
* 项目名称、ID、根目录、远程地址
* 个人和继承的本能计数
* 观察事件计数
* 最后看到的时间戳
3. 同时显示全局本能总数

View File

@@ -0,0 +1,41 @@
---
name: promote
description: 将项目范围内的本能推广到全局范围
command: true
---
# 提升命令
在 continuous-learning-v2 中将本能从项目范围提升到全局范围。
## 实现
使用插件根路径运行本能 CLI
```bash
python3 "${CLAUDE_PLUGIN_ROOT}/skills/continuous-learning-v2/scripts/instinct-cli.py" promote [instinct-id] [--force] [--dry-run]
```
或者如果未设置 `CLAUDE_PLUGIN_ROOT`(手动安装):
```bash
python3 ~/.claude/skills/continuous-learning-v2/scripts/instinct-cli.py promote [instinct-id] [--force] [--dry-run]
```
## 用法
```bash
/promote # Auto-detect promotion candidates
/promote --dry-run # Preview auto-promotion candidates
/promote --force # Promote all qualified candidates without prompt
/promote grep-before-edit # Promote one specific instinct from current project
```
## 操作步骤
1. 检测当前项目
2. 如果提供了 `instinct-id`,则仅提升该本能(如果存在于当前项目中)
3. 否则,查找跨项目候选本能,这些本能:
* 出现在至少 2 个项目中
* 满足置信度阈值
4. 将提升后的本能写入 `~/.claude/homunculus/instincts/personal/`,并设置 `scope: global`

View File

@@ -0,0 +1,30 @@
# 质量门命令
按需对文件或项目范围运行 ECC 质量管道。
## 用法
`/quality-gate [path|.] [--fix] [--strict]`
* 默认目标:当前目录 (`.`)
* `--fix`:在已配置的地方允许自动格式化/修复
* `--strict`:在支持的地方警告即失败
## 管道
1. 检测目标的语言/工具。
2. 运行格式化检查。
3. 在可用时运行代码检查/类型检查。
4. 生成简洁的修复列表。
## 备注
此命令镜像了钩子行为,但由操作员调用。
## 参数
$ARGUMENTS:
* `[path|.]` 可选的目标路径
* `--fix` 可选
* `--strict` 可选

220
docs/zh-CN/hooks/README.md Normal file
View File

@@ -0,0 +1,220 @@
# 钩子
钩子是事件驱动的自动化程序,在 Claude Code 工具执行前后触发。它们用于强制执行代码质量、及早发现错误以及自动化重复性检查。
## 钩子如何工作
```
User request → Claude picks a tool → PreToolUse hook runs → Tool executes → PostToolUse hook runs
```
* **PreToolUse** 钩子在工具执行前运行。它们可以**阻止**(退出码 2或**警告**stderr 输出但不阻止)。
* **PostToolUse** 钩子在工具完成后运行。它们可以分析输出但不能阻止执行。
* **Stop** 钩子在每次 Claude 响应后运行。
* **SessionStart/SessionEnd** 钩子在会话生命周期的边界处运行。
* **PreCompact** 钩子在上下文压缩前运行,适用于保存状态。
## 本插件中的钩子
### PreToolUse 钩子
| 钩子 | 匹配器 | 行为 | 退出码 |
|------|---------|----------|-----------|
| **开发服务器阻止器** | `Bash` | 在 tmux 外部阻止 `npm run dev` 等命令 —— 确保日志访问 | 2 (阻止) |
| **Tmux 提醒** | `Bash` | 建议对长时间运行的命令npm test, cargo build, docker使用 tmux | 0 (警告) |
| **Git push 提醒** | `Bash` | 提醒在 `git push` 前审查更改 | 0 (警告) |
| **文档文件警告** | `Write` | 警告非标准的 `.md`/`.txt` 文件(允许 README, CLAUDE, CONTRIBUTING, CHANGELOG, LICENSE, SKILL, docs/, skills/);跨平台路径处理 | 0 (警告) |
| **策略性压缩** | `Edit\|Write` | 建议在逻辑间隔(约每 50 次工具调用)手动执行 `/compact` | 0 (警告) |
### PostToolUse 钩子
| 钩子 | 匹配器 | 功能 |
|------|---------|-------------|
| **PR 记录器** | `Bash` | 在 `gh pr create` 后记录 PR URL 和审查命令 |
| **构建分析** | `Bash` | 构建命令后的后台分析(异步,非阻塞) |
| **质量门** | `Edit\|Write\|MultiEdit` | 在编辑后运行快速质量检查 |
| **Prettier 格式化** | `Edit` | 编辑后使用 Prettier 自动格式化 JS/TS 文件 |
| **TypeScript 检查** | `Edit` | 在编辑 `.ts`/`.tsx` 文件后运行 `tsc --noEmit` |
| **console.log 警告** | `Edit` | 警告编辑的文件中存在 `console.log` 语句 |
### 生命周期钩子
| 钩子 | 事件 | 功能 |
|------|-------|-------------|
| **会话开始** | `SessionStart` | 加载先前上下文并检测包管理器 |
| **预压缩** | `PreCompact` | 在上下文压缩前保存状态 |
| **Console.log 审计** | `Stop` | 每次响应后检查所有修改的文件是否有 `console.log` |
| **会话摘要** | `Stop` | 当转录路径可用时持久化会话状态 |
| **模式提取** | `Stop` | 评估会话以提取可抽取的模式(持续学习) |
| **成本追踪器** | `Stop` | 发出轻量级的运行成本遥测标记 |
| **会话结束标记** | `SessionEnd` | 生命周期标记和清理日志 |
## 自定义钩子
### 禁用钩子
`hooks.json` 中移除或注释掉钩子条目。如果作为插件安装,请在您的 `~/.claude/settings.json` 中覆盖:
```json
{
"hooks": {
"PreToolUse": [
{
"matcher": "Write",
"hooks": [],
"description": "Override: allow all .md file creation"
}
]
}
}
```
### 运行时钩子控制(推荐)
使用环境变量控制钩子行为,无需编辑 `hooks.json`
```bash
# minimal | standard | strict (default: standard)
export ECC_HOOK_PROFILE=standard
# Disable specific hook IDs (comma-separated)
export ECC_DISABLED_HOOKS="pre:bash:tmux-reminder,post:edit:typecheck"
```
配置文件:
* `minimal` —— 仅保留必要的生命周期和安全钩子。
* `standard` —— 默认;平衡的质量 + 安全检查。
* `strict` —— 启用额外的提醒和更严格的防护措施。
### 编写你自己的钩子
钩子是 shell 命令,通过 stdin 接收 JSON 格式的工具输入,并且必须在 stdout 上输出 JSON。
**基本结构:**
```javascript
// my-hook.js
let data = '';
process.stdin.on('data', chunk => data += chunk);
process.stdin.on('end', () => {
const input = JSON.parse(data);
// Access tool info
const toolName = input.tool_name; // "Edit", "Bash", "Write", etc.
const toolInput = input.tool_input; // Tool-specific parameters
const toolOutput = input.tool_output; // Only available in PostToolUse
// Warn (non-blocking): write to stderr
console.error('[Hook] Warning message shown to Claude');
// Block (PreToolUse only): exit with code 2
// process.exit(2);
// Always output the original data to stdout
console.log(data);
});
```
**退出码:**
* `0` —— 成功(继续执行)
* `2` —— 阻止工具调用(仅限 PreToolUse
* 其他非零值 —— 错误(记录日志但不阻止)
### 钩子输入模式
```typescript
interface HookInput {
tool_name: string; // "Bash", "Edit", "Write", "Read", etc.
tool_input: {
command?: string; // Bash: the command being run
file_path?: string; // Edit/Write/Read: target file
old_string?: string; // Edit: text being replaced
new_string?: string; // Edit: replacement text
content?: string; // Write: file content
};
tool_output?: { // PostToolUse only
output?: string; // Command/tool output
};
}
```
### 异步钩子
对于不应阻塞主流程的钩子(例如,后台分析):
```json
{
"type": "command",
"command": "node my-slow-hook.js",
"async": true,
"timeout": 30
}
```
异步钩子在后台运行。它们不能阻止工具执行。
## 常用钩子配方
### 警告 TODO 注释
```json
{
"matcher": "Edit",
"hooks": [{
"type": "command",
"command": "node -e \"let d='';process.stdin.on('data',c=>d+=c);process.stdin.on('end',()=>{const i=JSON.parse(d);const ns=i.tool_input?.new_string||'';if(/TODO|FIXME|HACK/.test(ns)){console.error('[Hook] New TODO/FIXME added - consider creating an issue')}console.log(d)})\""
}],
"description": "Warn when adding TODO/FIXME comments"
}
```
### 阻止创建大文件
```json
{
"matcher": "Write",
"hooks": [{
"type": "command",
"command": "node -e \"let d='';process.stdin.on('data',c=>d+=c);process.stdin.on('end',()=>{const i=JSON.parse(d);const c=i.tool_input?.content||'';const lines=c.split('\\n').length;if(lines>800){console.error('[Hook] BLOCKED: File exceeds 800 lines ('+lines+' lines)');console.error('[Hook] Split into smaller, focused modules');process.exit(2)}console.log(d)})\""
}],
"description": "Block creation of files larger than 800 lines"
}
```
### 使用 ruff 自动格式化 Python 文件
```json
{
"matcher": "Edit",
"hooks": [{
"type": "command",
"command": "node -e \"let d='';process.stdin.on('data',c=>d+=c);process.stdin.on('end',()=>{const i=JSON.parse(d);const p=i.tool_input?.file_path||'';if(/\\.py$/.test(p)){const{execFileSync}=require('child_process');try{execFileSync('ruff',['format',p],{stdio:'pipe'})}catch(e){}}console.log(d)})\""
}],
"description": "Auto-format Python files with ruff after edits"
}
```
### 要求新源文件附带测试文件
```json
{
"matcher": "Write",
"hooks": [{
"type": "command",
"command": "node -e \"const fs=require('fs');let d='';process.stdin.on('data',c=>d+=c);process.stdin.on('end',()=>{const i=JSON.parse(d);const p=i.tool_input?.file_path||'';if(/src\\/.*\\.(ts|js)$/.test(p)&&!/\\.test\\.|\\.spec\\./.test(p)){const testPath=p.replace(/\\.(ts|js)$/,'.test.$1');if(!fs.existsSync(testPath)){console.error('[Hook] No test file found for: '+p);console.error('[Hook] Expected: '+testPath);console.error('[Hook] Consider writing tests first (/tdd)')}}console.log(d)})\""
}],
"description": "Remind to create tests when adding new source files"
}
```
## 跨平台注意事项
钩子逻辑在 Node.js 脚本中实现,以便在 Windows、macOS 和 Linux 上具有跨平台行为。保留了少量 shell 包装器用于持续学习的观察者钩子;这些包装器受配置文件控制,并具有 Windows 安全的回退行为。
## 相关
* [rules/common/hooks.md](../rules/common/hooks.md) —— 钩子架构指南
* [skills/strategic-compact/](../../../skills/strategic-compact) —— 策略性压缩技能
* [scripts/hooks/](../../../scripts/hooks) —— 钩子脚本实现

View File

@@ -14,7 +14,7 @@
# Add official Anthropic marketplace
claude plugin marketplace add https://github.com/anthropics/claude-plugins-official
# Add community marketplaces
# Add community marketplaces (mgrep by @mixedbread-ai)
claude plugin marketplace add https://github.com/mixedbread-ai/mgrep
```
@@ -24,7 +24,7 @@ claude plugin marketplace add https://github.com/mixedbread-ai/mgrep
|-------------|--------|
| claude-plugins-official | `anthropics/claude-plugins-official` |
| claude-code-plugins | `anthropics/claude-code` |
| Mixedbread-Grep | `mixedbread-ai/mgrep` |
| Mixedbread-Grep (@mixedbread-ai) | `mixedbread-ai/mgrep` |
***

View File

@@ -2,28 +2,36 @@
> 本文档在 [common/git-workflow.md](git-workflow.md) 的基础上进行了扩展,涵盖了在 git 操作之前发生的完整功能开发过程。
功能实现工作流描述了开发管道:规划、测试驱动开发、代码审查,然后提交到 git。
功能实现工作流描述了开发流水线研究、规划、TDD、代码审查,然后提交到 git。
## 功能实现工作流程
1. **先行规划**
* 使用 **planner** 代理创建实现计划
0. **研究与复用** *(任何新实现之前强制进行)*
* **首先进行 GitHub 代码搜索:** 在编写任何新内容之前,运行 `gh search repos``gh search code` 以查找现有的实现、模板和模式。
* **使用 Exa MCP 进行研究:** 在规划阶段使用 `exa-web-search` MCP 进行更广泛的研究、数据摄取和发现现有技术。
* **检查包注册表:** 在编写工具代码之前,搜索 npm、PyPI、crates.io 和其他注册表。优先选择经过实战检验的库,而不是自己编写的解决方案。
* **搜索可适配的实现:** 寻找能够解决 80% 以上问题并且可以分叉、移植或包装的开源项目。
* 当满足要求时,优先采用或移植经过验证的方法,而不是编写全新的代码。
1. **先规划**
* 使用 **planner** 代理创建实施计划
* 在编码前生成规划文档PRD、架构、系统设计、技术文档、任务列表
* 识别依赖项和风险
* 分解为多个阶段
2. **测试驱动开发方法**
2. **TDD 方法**
* 使用 **tdd-guide** 代理
*写测试(红)
* 实现代码以通过测试(绿)
* 重构(改进)
* 验证 80% 以上的覆盖率
* 先写测试 (RED)
* 实现以通过测试 (GREEN)
* 重构 (IMPROVE)
* 验证 80%+ 的覆盖率
3. **代码审查**
* 编写代码后立即使用 **code-reviewer** 代理
* 解决 CRITICAL 和 HIGH 级别的问题
* 处理 CRITICAL 和 HIGH 级别的问题
* 尽可能修复 MEDIUM 级别的问题
4. **提交与推送**
* 详细的提交信息
* 遵循约定式提交格式
* 关提交信息格式和 PR 流程,请参阅 [git-workflow.md](git-workflow.md)
*提交信息格式和 PR 流程,请参阅 [git-workflow.md](git-workflow.md)

View File

@@ -0,0 +1,77 @@
---
name: agent-harness-construction
description: 设计和优化AI代理的动作空间、工具定义和观察格式以提高完成率。
origin: ECC
---
# 智能体框架构建
当你在改进智能体的规划、调用工具、从错误中恢复以及收敛到完成状态的方式时,使用此技能。
## 核心模型
智能体输出质量受限于:
1. 行动空间质量
2. 观察质量
3. 恢复质量
4. 上下文预算质量
## 行动空间设计
1. 使用稳定、明确的工具名称。
2. 保持输入模式优先且范围狭窄。
3. 返回确定性的输出形状。
4. 除非无法隔离,否则避免使用全能型工具。
## 粒度规则
* 对高风险操作(部署、迁移、权限)使用微工具。
* 对常见的编辑/读取/搜索循环使用中等工具。
* 仅当往返开销是主要成本时使用宏工具。
## 观察设计
每个工具响应都应包括:
* `status`: success|warning|error
* `summary`: 一行结果
* `next_actions`: 可执行的后续步骤
* `artifacts`: 文件路径 / ID
## 错误恢复契约
对于每个错误路径,应包括:
* 根本原因提示
* 安全重试指令
* 明确的停止条件
## 上下文预算管理
1. 保持系统提示词最少且不变。
2. 将大量指导信息移至按需加载的技能中。
3. 优先引用文件,而不是内联长文档。
4. 在阶段边界处进行压缩,而不是任意的令牌阈值。
## 架构模式指导
* ReAct最适合路径不确定的探索性任务。
* 函数调用:最适合结构化的确定性流程。
* 混合模式推荐ReAct 规划 + 类型化工具执行。
## 基准测试
跟踪:
* 完成率
* 每项任务的重试次数
* pass@1 和 pass@3
* 每个成功任务的成本
## 反模式
* 太多语义重叠的工具。
* 不透明的工具输出,没有恢复提示。
* 仅输出错误而没有后续步骤。
* 上下文过载,包含不相关的引用。

View File

@@ -0,0 +1,66 @@
---
name: agentic-engineering
description: 作为代理工程师,采用评估优先执行、分解和成本感知模型路由进行操作。
origin: ECC
---
# 智能体工程
在 AI 智能体执行大部分实施工作、而人类负责质量与风险控制的工程工作流中使用此技能。
## 操作原则
1. 在执行前定义完成标准。
2. 将工作分解为智能体可处理的单元。
3. 根据任务复杂度路由模型层级。
4. 使用评估和回归检查进行度量。
## 评估优先循环
1. 定义能力评估和回归评估。
2. 运行基线并捕获失败特征。
3. 执行实施。
4. 重新运行评估并比较差异。
## 任务分解
应用 15 分钟单元规则:
* 每个单元应可独立验证
* 每个单元应有一个主要风险
* 每个单元应暴露一个清晰的完成条件
## 模型路由
* Haiku分类、样板转换、狭窄编辑
* Sonnet实施和重构
* Opus架构、根因分析、多文件不变量
## 会话策略
* 对于紧密耦合的单元,继续使用同一会话。
* 在主要阶段转换后,启动新的会话。
* 在里程碑完成后进行压缩,而不是在主动调试期间。
## AI 生成代码的审查重点
优先审查:
* 不变量和边界情况
* 错误边界
* 安全性和身份验证假设
* 隐藏的耦合和上线风险
当自动化格式化/代码检查工具已强制执行代码风格时,不要在仅涉及风格分歧的审查上浪费周期。
## 成本纪律
按任务跟踪:
* 模型
* 令牌估算
* 重试次数
* 实际用时
* 成功/失败
仅当较低层级的模型失败且存在清晰的推理差距时,才升级模型层级。

View File

@@ -0,0 +1,55 @@
---
name: ai-first-engineering
description: 团队中人工智能代理生成大部分实施输出的工程运营模型。
origin: ECC
---
# 人工智能优先工程
在为由人工智能辅助代码生成的团队设计流程、评审和架构时,使用此技能。
## 流程转变
1. 规划质量比打字速度更重要。
2. 评估覆盖率比主观信心更重要。
3. 评审重点从语法转向系统行为。
## 架构要求
优先选择对智能体友好的架构:
* 明确的边界
* 稳定的契约
* 类型化的接口
* 确定性的测试
避免隐含的行为分散在隐藏的惯例中。
## 人工智能优先团队中的代码评审
评审关注:
* 行为回归
* 安全假设
* 数据完整性
* 故障处理
* 发布安全性
尽量减少花在已由自动化覆盖的风格问题上的时间。
## 招聘和评估信号
强大的人工智能优先工程师:
* 能清晰地分解模糊的工作
* 定义可衡量的验收标准
* 生成高价值的提示和评估
* 在交付压力下执行风险控制
## 测试标准
提高生成代码的测试标准:
* 对涉及的领域要求回归测试覆盖率
* 明确的边界情况断言
* 接口边界的集成检查

View File

@@ -0,0 +1,621 @@
---
name: autonomous-loops
description: "自主Claude代码循环的模式与架构——从简单的顺序管道到基于RFC的多智能体有向无环图系统。"
origin: ECC
---
# 自主循环技能
> 兼容性说明 (v1.8.0): `autonomous-loops` 保留一个发布周期。
> 规范的技能名称现在是 `continuous-agent-loop`。新的循环指南应在此处编写,而此技能继续可用以避免破坏现有工作流。
在循环中自主运行 Claude Code 的模式、架构和参考实现。涵盖从简单的 `claude -p` 管道到完整的 RFC 驱动的多智能体 DAG 编排的一切。
## 何时使用
* 建立无需人工干预即可运行的自主开发工作流
* 为你的问题选择正确的循环架构(简单与复杂)
* 构建 CI/CD 风格的持续开发管道
* 运行具有合并协调的并行智能体
* 在循环迭代中实现上下文持久化
* 为自主工作流添加质量门和清理步骤
## 循环模式谱系
从最简单到最复杂:
| 模式 | 复杂度 | 最适合 |
|---------|-----------|----------|
| [顺序管道](#1-顺序管道-claude--p) | 低 | 日常开发步骤,脚本化工作流 |
| [NanoClaw REPL](#2-nanoclaw-repl) | 低 | 交互式持久会话 |
| [无限智能体循环](#3-无限智能体循环) | 中 | 并行内容生成,规范驱动的工作 |
| [持续 Claude PR 循环](#4-持续-claude-pr-循环) | 中 | 具有 CI 门的跨天迭代项目 |
| [去草率化模式](#5-去草率化模式) | 附加 | 任何实现者步骤后的质量清理 |
| [Ralphinho / RFC 驱动的 DAG](#6-ralphinho--rfc-驱动的-dag-编排) | 高 | 大型功能,具有合并队列的多单元并行工作 |
***
## 1. 顺序管道 (`claude -p`)
**最简单的循环。** 将日常开发分解为一系列非交互式 `claude -p` 调用。每次调用都是一个具有清晰提示的专注步骤。
### 核心见解
> 如果你无法想出这样的循环,那意味着你甚至无法在交互模式下驱动 LLM 来修复你的代码。
`claude -p` 标志以非交互方式运行 Claude Code 并附带提示,完成后退出。链式调用来构建管道:
```bash
#!/bin/bash
# daily-dev.sh — Sequential pipeline for a feature branch
set -e
# Step 1: Implement the feature
claude -p "Read the spec in docs/auth-spec.md. Implement OAuth2 login in src/auth/. Write tests first (TDD). Do NOT create any new documentation files."
# Step 2: De-sloppify (cleanup pass)
claude -p "Review all files changed by the previous commit. Remove any unnecessary type tests, overly defensive checks, or testing of language features (e.g., testing that TypeScript generics work). Keep real business logic tests. Run the test suite after cleanup."
# Step 3: Verify
claude -p "Run the full build, lint, type check, and test suite. Fix any failures. Do not add new features."
# Step 4: Commit
claude -p "Create a conventional commit for all staged changes. Use 'feat: add OAuth2 login flow' as the message."
```
### 关键设计原则
1. **每个步骤都是隔离的** — 每次 `claude -p` 调用都是一个新的上下文窗口,意味着步骤之间没有上下文泄露。
2. **顺序很重要** — 步骤按顺序执行。每个步骤都建立在前一个步骤留下的文件系统状态之上。
3. **否定指令是危险的** — 不要说“不要测试类型系统。”相反,添加一个单独的清理步骤(参见[去草率化模式](#5-去草率化模式))。
4. **退出代码会传播**`set -e` 在失败时停止管道。
### 变体
**使用模型路由:**
```bash
# Research with Opus (deep reasoning)
claude -p --model opus "Analyze the codebase architecture and write a plan for adding caching..."
# Implement with Sonnet (fast, capable)
claude -p "Implement the caching layer according to the plan in docs/caching-plan.md..."
# Review with Opus (thorough)
claude -p --model opus "Review all changes for security issues, race conditions, and edge cases..."
```
**使用环境上下文:**
```bash
# Pass context via files, not prompt length
echo "Focus areas: auth module, API rate limiting" > .claude-context.md
claude -p "Read .claude-context.md for priorities. Work through them in order."
rm .claude-context.md
```
**使用 `--allowedTools` 限制:**
```bash
# Read-only analysis pass
claude -p --allowedTools "Read,Grep,Glob" "Audit this codebase for security vulnerabilities..."
# Write-only implementation pass
claude -p --allowedTools "Read,Write,Edit,Bash" "Implement the fixes from security-audit.md..."
```
***
## 2. NanoClaw REPL
**ECC 内置的持久循环。** 一个具有会话感知的 REPL它使用完整的对话历史同步调用 `claude -p`
```bash
# Start the default session
node scripts/claw.js
# Named session with skill context
CLAW_SESSION=my-project CLAW_SKILLS=tdd-workflow,security-review node scripts/claw.js
```
### 工作原理
1.`~/.claude/claw/{session}.md` 加载对话历史
2. 每个用户消息都连同完整历史记录作为上下文发送给 `claude -p`
3. 响应被追加到会话文件中Markdown 作为数据库)
4. 会话在重启后持久存在
### NanoClaw 与顺序管道的选择
| 用例 | NanoClaw | 顺序管道 |
|----------|----------|-------------------|
| 交互式探索 | 是 | 否 |
| 脚本化自动化 | 否 | 是 |
| 会话持久性 | 内置 | 手动 |
| 上下文累积 | 每轮增长 | 每个步骤都是新的 |
| CI/CD 集成 | 差 | 优秀 |
有关完整详情,请参阅 `/claw` 命令文档。
***
## 3. 无限智能体循环
**一个双提示系统**,用于编排并行子智能体以进行规范驱动的生成。由 disler 开发(致谢:@disler)。
### 架构:双提示系统
```
PROMPT 1 (Orchestrator) PROMPT 2 (Sub-Agents)
┌─────────────────────┐ ┌──────────────────────┐
│ Parse spec file │ │ Receive full context │
│ Scan output dir │ deploys │ Read assigned number │
│ Plan iteration │────────────│ Follow spec exactly │
│ Assign creative dirs │ N agents │ Generate unique output │
│ Manage waves │ │ Save to output dir │
└─────────────────────┘ └──────────────────────┘
```
### 模式
1. **规范分析** — 编排器读取一个定义要生成内容的规范文件Markdown
2. **目录侦察** — 扫描现有输出以找到最高的迭代编号
3. **并行部署** — 启动 N 个子智能体,每个都有:
* 完整的规范
* 独特的创意方向
* 特定的迭代编号(无冲突)
* 现有迭代的快照(用于确保唯一性)
4. **波次管理** — 对于无限模式,部署 3-5 个智能体的波次,直到上下文耗尽
### 通过 Claude Code 命令实现
创建 `.claude/commands/infinite.md`
```markdown
从 $ARGUMENTS 中解析以下参数:
1. spec_file — 规范 Markdown 文件的路径
2. output_dir — 保存迭代结果的目录
3. count — 整数 1-N 或 "infinite"
阶段 1 读取并深入理解规范。
阶段 2 列出 output_dir找到最高的迭代编号。从 N+1 开始。
阶段 3 规划创意方向 — 每个代理获得一个**不同的**主题/方法。
阶段 4 并行部署子代理(使用 Task 工具)。每个代理接收:
- 完整的规范文本
- 当前目录快照
- 它们被分配的迭代编号
- 它们独特的创意方向
阶段 5无限模式 以 3-5 个为一波进行循环,直到上下文不足为止。
```
**调用:**
```bash
/project:infinite specs/component-spec.md src/ 5
/project:infinite specs/component-spec.md src/ infinite
```
### 批处理策略
| 数量 | 策略 |
|-------|----------|
| 1-5 | 所有智能体同时运行 |
| 6-20 | 每批 5 个 |
| 无限 | 3-5 个一波,逐步复杂化 |
### 关键见解:通过分配实现唯一性
不要依赖智能体自我区分。编排器**分配**给每个智能体一个特定的创意方向和迭代编号。这可以防止并行智能体之间的概念重复。
***
## 4. 持续 Claude PR 循环
**一个生产级的 shell 脚本**,在持续循环中运行 Claude Code创建 PR等待 CI并自动合并。由 AnandChowdhary 创建(致谢:@AnandChowdhary)。
### 核心循环
```
┌─────────────────────────────────────────────────────┐
│ CONTINUOUS CLAUDE ITERATION │
│ │
│ 1. Create branch (continuous-claude/iteration-N) │
│ 2. Run claude -p with enhanced prompt │
│ 3. (Optional) Reviewer pass — separate claude -p │
│ 4. Commit changes (claude generates message) │
│ 5. Push + create PR (gh pr create) │
│ 6. Wait for CI checks (poll gh pr checks) │
│ 7. CI failure? → Auto-fix pass (claude -p) │
│ 8. Merge PR (squash/merge/rebase) │
│ 9. Return to main → repeat │
│ │
│ Limit by: --max-runs N | --max-cost $X │
│ --max-duration 2h | completion signal │
└─────────────────────────────────────────────────────┘
```
### 安装
```bash
curl -fsSL https://raw.githubusercontent.com/AnandChowdhary/continuous-claude/HEAD/install.sh | bash
```
### 用法
```bash
# Basic: 10 iterations
continuous-claude --prompt "Add unit tests for all untested functions" --max-runs 10
# Cost-limited
continuous-claude --prompt "Fix all linter errors" --max-cost 5.00
# Time-boxed
continuous-claude --prompt "Improve test coverage" --max-duration 8h
# With code review pass
continuous-claude \
--prompt "Add authentication feature" \
--max-runs 10 \
--review-prompt "Run npm test && npm run lint, fix any failures"
# Parallel via worktrees
continuous-claude --prompt "Add tests" --max-runs 5 --worktree tests-worker &
continuous-claude --prompt "Refactor code" --max-runs 5 --worktree refactor-worker &
wait
```
### 跨迭代上下文SHARED\_TASK\_NOTES.md
关键创新:一个 `SHARED_TASK_NOTES.md` 文件在迭代间持久存在:
```markdown
## 进展
- [x] 已添加认证模块测试第1轮
- [x] 已修复令牌刷新中的边界情况第2轮
- [ ] 仍需完成:速率限制测试、错误边界测试
## 后续步骤
- 接下来专注于速率限制模块
- 测试中位于 `tests/helpers.ts` 的模拟设置可以复用
```
Claude 在迭代开始时读取此文件,并在迭代结束时更新它。这弥合了独立 `claude -p` 调用之间的上下文差距。
### CI 失败恢复
当 PR 检查失败时,持续 Claude 会自动:
1. 通过 `gh run list` 获取失败的运行 ID
2. 生成一个新的带有 CI 修复上下文的 `claude -p`
3. Claude 通过 `gh run view` 检查日志,修复代码,提交,推送
4. 重新等待检查(最多 `--ci-retry-max` 次尝试)
### 完成信号
Claude 可以通过输出一个魔法短语来发出“我完成了”的信号:
```bash
continuous-claude \
--prompt "Fix all bugs in the issue tracker" \
--completion-signal "CONTINUOUS_CLAUDE_PROJECT_COMPLETE" \
--completion-threshold 3 # Stops after 3 consecutive signals
```
连续三次迭代发出完成信号会停止循环,防止在已完成的工作上浪费运行。
### 关键配置
| 标志 | 目的 |
|------|---------|
| `--max-runs N` | 在 N 次成功迭代后停止 |
| `--max-cost $X` | 在花费 $X 后停止 |
| `--max-duration 2h` | 在时间过去后停止 |
| `--merge-strategy squash` | squash、merge 或 rebase |
| `--worktree <name>` | 通过 git worktrees 并行执行 |
| `--disable-commits` | 试运行模式(无 git 操作) |
| `--review-prompt "..."` | 每次迭代添加审阅者审核 |
| `--ci-retry-max N` | 自动修复 CI 失败默认1 |
***
## 5. 去草率化模式
**任何循环的附加模式。** 在每个实现者步骤之后添加一个专门的清理/重构步骤。
### 问题
当你要求 LLM 使用 TDD 实现时,它对“编写测试”的理解过于字面:
* 测试验证 TypeScript 的类型系统是否有效(测试 `typeof x === 'string'`
* 对类型系统已经保证的东西进行过度防御的运行时检查
* 测试框架行为而非业务逻辑
* 过多的错误处理掩盖了实际代码
### 为什么不使用否定指令?
在实现者提示中添加“不要测试类型系统”或“不要添加不必要的检查”会产生下游影响:
* 模型对所有测试都变得犹豫不决
* 它会跳过合法的边缘情况测试
* 质量不可预测地下降
### 解决方案:单独的步骤
与其限制实现者,不如让它彻底。然后添加一个专注的清理智能体:
```bash
# Step 1: Implement (let it be thorough)
claude -p "Implement the feature with full TDD. Be thorough with tests."
# Step 2: De-sloppify (separate context, focused cleanup)
claude -p "Review all changes in the working tree. Remove:
- Tests that verify language/framework behavior rather than business logic
- Redundant type checks that the type system already enforces
- Over-defensive error handling for impossible states
- Console.log statements
- Commented-out code
Keep all business logic tests. Run the test suite after cleanup to ensure nothing breaks."
```
### 在循环上下文中
```bash
for feature in "${features[@]}"; do
# Implement
claude -p "Implement $feature with TDD."
# De-sloppify
claude -p "Cleanup pass: review changes, remove test/code slop, run tests."
# Verify
claude -p "Run build + lint + tests. Fix any failures."
# Commit
claude -p "Commit with message: feat: add $feature"
done
```
### 关键见解
> 与其添加具有下游质量影响的否定指令,不如添加一个单独的去草率化步骤。两个专注的智能体胜过一个有约束的智能体。
***
## 6. Ralphinho / RFC 驱动的 DAG 编排
**最复杂的模式。** 一个 RFC 驱动的多智能体管道,将规范分解为依赖关系 DAG通过分层质量管道运行每个单元并通过智能体驱动的合并队列落地。由 enitrat 创建(致谢:@enitrat)。
### 架构概述
```
RFC/PRD Document
DECOMPOSITION (AI)
Break RFC into work units with dependency DAG
┌──────────────────────────────────────────────────────┐
│ RALPH LOOP (up to 3 passes) │
│ │
│ For each DAG layer (sequential, by dependency): │
│ │
│ ┌── Quality Pipelines (parallel per unit) ───────┐ │
│ │ Each unit in its own worktree: │ │
│ │ Research → Plan → Implement → Test → Review │ │
│ │ (depth varies by complexity tier) │ │
│ └────────────────────────────────────────────────┘ │
│ │
│ ┌── Merge Queue ─────────────────────────────────┐ │
│ │ Rebase onto main → Run tests → Land or evict │ │
│ │ Evicted units re-enter with conflict context │ │
│ └────────────────────────────────────────────────┘ │
│ │
└──────────────────────────────────────────────────────┘
```
### RFC 分解
AI 读取 RFC 并生成工作单元:
```typescript
interface WorkUnit {
id: string; // kebab-case identifier
name: string; // Human-readable name
rfcSections: string[]; // Which RFC sections this addresses
description: string; // Detailed description
deps: string[]; // Dependencies (other unit IDs)
acceptance: string[]; // Concrete acceptance criteria
tier: "trivial" | "small" | "medium" | "large";
}
```
**分解规则:**
* 倾向于更少、内聚的单元(最小化合并风险)
* 最小化跨单元文件重叠(避免冲突)
* 保持测试与实现在一起(永远不要分开“实现 X” + “测试 X”
* 仅在实际存在代码依赖关系的地方设置依赖关系
依赖关系 DAG 决定了执行顺序:
```
Layer 0: [unit-a, unit-b] ← no deps, run in parallel
Layer 1: [unit-c] ← depends on unit-a
Layer 2: [unit-d, unit-e] ← depend on unit-c
```
### 复杂度层级
不同的层级获得不同深度的管道:
| 层级 | 管道阶段 |
|------|----------------|
| **trivial** | implement → test |
| **small** | implement → test → code-review |
| **medium** | research → plan → implement → test → PRD-review + code-review → review-fix |
| **large** | research → plan → implement → test → PRD-review + code-review → review-fix → final-review |
这可以防止对简单更改进行昂贵的操作,同时确保架构更改得到彻底审查。
### 独立的上下文窗口(消除作者偏见)
每个阶段在其自己的智能体进程中运行,拥有自己的上下文窗口:
| 阶段 | 模型 | 目的 |
|-------|-------|---------|
| Research | Sonnet | 读取代码库 + RFC生成上下文文档 |
| Plan | Opus | 设计实现步骤 |
| Implement | Codex | 按照计划编写代码 |
| Test | Sonnet | 运行构建 + 测试套件 |
| PRD Review | Sonnet | 规范合规性检查 |
| Code Review | Opus | 质量 + 安全检查 |
| Review Fix | Codex | 处理审阅问题 |
| Final Review | Opus | 质量门(仅限大型层级) |
**关键设计:** 审阅者从未编写过它要审阅的代码。这消除了作者偏见——这是自我审阅中遗漏问题的最常见原因。
### 具有驱逐功能的合并队列
质量管道完成后,单元进入合并队列:
```
Unit branch
├─ Rebase onto main
│ └─ Conflict? → EVICT (capture conflict context)
├─ Run build + tests
│ └─ Fail? → EVICT (capture test output)
└─ Pass → Fast-forward main, push, delete branch
```
**文件重叠智能:**
* 非重叠单元并行推测性地落地
* 重叠单元逐个落地,每次重新变基
**驱逐恢复:**
被驱逐时,会捕获完整上下文(冲突文件、差异、测试输出)并反馈给下一个 Ralph 轮次的实现者:
```markdown
## 合并冲突 — 在下一次推送前解决
您之前的实现与另一个已先推送的单元发生了冲突。
请重构您的更改以避免以下冲突的文件/行。
{完整的排除上下文及差异}
```
### 阶段间的数据流
```
research.contextFilePath ──────────────────→ plan
plan.implementationSteps ──────────────────→ implement
implement.{filesCreated, whatWasDone} ─────→ test, reviews
test.failingSummary ───────────────────────→ reviews, implement (next pass)
reviews.{feedback, issues} ────────────────→ review-fix → implement (next pass)
final-review.reasoning ────────────────────→ implement (next pass)
evictionContext ───────────────────────────→ implement (after merge conflict)
```
### 工作树隔离
每个单元在隔离的工作树中运行(使用 jj/Jujutsu而不是 git
```
/tmp/workflow-wt-{unit-id}/
```
同一单元的管道阶段**共享**一个工作树,在 research → plan → implement → test → review 之间保留状态(上下文文件、计划文件、代码更改)。
### 关键设计原则
1. **确定性执行** — 预先分解锁定并行性和顺序
2. **在杠杆点进行人工审阅** — 工作计划是单一最高杠杆干预点
3. **关注点分离** — 每个阶段在独立的上下文窗口中,由独立的智能体负责
4. **带上下文的冲突恢复** — 完整的驱逐上下文支持智能重试,而非盲目重试
5. **层级驱动的深度** — 琐碎更改跳过研究/审阅;大型更改获得最大审查
6. **可恢复的工作流** — 完整状态持久化到 SQLite可从任何点恢复
### 何时使用 Ralphinho 与更简单的模式
| 信号 | 使用 Ralphinho | 使用更简单的模式 |
|--------|--------------|-------------------|
| 多个相互依赖的工作单元 | 是 | 否 |
| 需要并行实现 | 是 | 否 |
| 可能出现合并冲突 | 是 | 否(顺序即可) |
| 单文件更改 | 否 | 是(顺序管道) |
| 跨天项目 | 是 | 可能(持续-claude |
| 规范/RFC 已编写 | 是 | 可能 |
| 对单个事物的快速迭代 | 否 | 是NanoClaw 或管道) |
***
## 选择正确的模式
### 决策矩阵
```
Is the task a single focused change?
├─ Yes → Sequential Pipeline or NanoClaw
└─ No → Is there a written spec/RFC?
├─ Yes → Do you need parallel implementation?
│ ├─ Yes → Ralphinho (DAG orchestration)
│ └─ No → Continuous Claude (iterative PR loop)
└─ No → Do you need many variations of the same thing?
├─ Yes → Infinite Agentic Loop (spec-driven generation)
└─ No → Sequential Pipeline with de-sloppify
```
### 模式组合
这些模式可以很好地组合:
1. **顺序流水线 + 去草率化** — 最常见的组合。每个实现步骤都进行一次清理。
2. **连续 Claude + 去草率化** — 为每次迭代添加带有去草率化指令的 `--review-prompt`
3. **任何循环 + 验证** — 在提交前,使用 ECC 的 `/verify` 命令或 `verification-loop` 技能作为关卡。
4. **Ralphinho 在简单循环中的分层方法** — 即使在顺序流水线中,你也可以将简单任务路由到 Haiku复杂任务路由到 Opus
```bash
# 简单的格式修复
claude -p --model haiku "Fix the import ordering in src/utils.ts"
# 复杂的架构变更
claude -p --model opus "Refactor the auth module to use the strategy pattern"
```
***
## 反模式
### 常见错误
1. **没有退出条件的无限循环** — 始终设置最大运行次数、最大成本、最大持续时间或完成信号。
2. **迭代之间没有上下文桥接** — 每次 `claude -p` 调用都从头开始。使用 `SHARED_TASK_NOTES.md` 或文件系统状态来桥接上下文。
3. **重试相同的失败** — 如果一次迭代失败,不要只是重试。捕获错误上下文并将其提供给下一次尝试。
4. **使用负面指令而非清理过程** — 不要说“不要做 X”。添加一个单独的步骤来移除 X。
5. **所有智能体都在一个上下文窗口中** — 对于复杂的工作流,将关注点分离到不同的智能体进程中。审查者永远不应该是作者。
6. **在并行工作中忽略文件重叠** — 如果两个并行智能体可能编辑同一个文件,你需要一个合并策略(顺序落地、变基或冲突解决)。
***
## 参考资料
| 项目 | 作者 | 链接 |
|---------|--------|------|
| Ralphinho | enitrat | credit: @enitrat |
| Infinite Agentic Loop | disler | credit: @disler |
| Continuous Claude | AnandChowdhary | credit: @AnandChowdhary |
| NanoClaw | ECC | 此仓库中的 `/claw` 命令 |
| Verification Loop | ECC | 此仓库中的 `skills/verification-loop/` |

View File

@@ -67,7 +67,24 @@ mkdir -p $TARGET/skills $TARGET/rules
## 步骤 2选择并安装技能
### 2a:选择技能类别
### 2a: 选择范围(核心 vs 细分领域)
默认为 **核心(推荐给新用户)** — 对于研究优先的工作流,复制 `.agents/skills/*` 加上 `skills/search-first/`。此捆绑包涵盖工程、评估、验证、安全、战略压缩、前端设计以及 Anthropic 跨职能技能(文章写作、内容引擎、市场研究、前端幻灯片)。
使用 `AskUserQuestion`(单选):
```
Question: "Install core skills only, or include niche/framework packs?"
Options:
- "Core only (recommended)" — "tdd, e2e, evals, verification, research-first, security, frontend patterns, compacting, cross-functional Anthropic skills"
- "Core + selected niche" — "Add framework/domain-specific skills after core"
- "Niche only" — "Skip core, install specific framework/domain skills"
Default: Core only
```
如果用户选择细分领域或核心 + 细分领域,则继续下面的类别选择,并且仅包含他们选择的那些细分领域技能。
### 2b: 选择技能类别
共有 27 项技能,分为 4 个类别。使用 `AskUserQuestion``multiSelect: true`
@@ -80,7 +97,7 @@ Options:
- "All skills" — "Install every available skill"
```
### 2b确认单项技能
### 2c: 确认个人技能
对于每个选定的类别,打印下面的完整技能列表,并要求用户确认或取消选择特定的技能。如果列表超过 4 项,将列表打印为文本,并使用 `AskUserQuestion`,提供一个 "安装所有列出项" 的选项,以及一个 "其他" 选项供用户粘贴特定名称。
@@ -143,7 +160,7 @@ Options:
|-------|-------------|
| `project-guidelines-example` | 用于创建项目特定技能的模板 |
### 2c执行安装
### 2d: 执行安装
对于每个选定的技能,复制整个技能目录:

View File

@@ -0,0 +1,46 @@
---
name: continuous-agent-loop
description: 具有质量门、评估和恢复控制的连续自主代理循环模式。
origin: ECC
---
# 持续代理循环
这是 v1.8+ 的规范循环技能名称。它在保持一个发布版本的兼容性的同时,取代了 `autonomous-loops`
## 循环选择流程
```text
Start
|
+-- Need strict CI/PR control? -- yes --> continuous-pr
|
+-- Need RFC decomposition? -- yes --> rfc-dag
|
+-- Need exploratory parallel generation? -- yes --> infinite
|
+-- default --> sequential
```
## 组合模式
推荐的生产栈:
1. RFC 分解 (`ralphinho-rfc-pipeline`)
2. 质量门 (`plankton-code-quality` + `/quality-gate`)
3. 评估循环 (`eval-harness`)
4. 会话持久化 (`nanoclaw-repl`)
## 故障模式
* 循环空转,没有可衡量的进展
* 因相同根本原因而重复重试
* 合并队列停滞
* 无限制升级导致的成本漂移
## 恢复
* 冻结循环
* 运行 `/harness-audit`
* 将范围缩小到失败单元
* 使用明确的验收标准重放

View File

@@ -1,33 +1,48 @@
---
name: continuous-learning-v2
description: 基于本能的学习系统,通过钩子观察会话,创建具有置信度评分的原子本能,并将其进化为技能/命令/代理。
description: 基于本能的学习系统,通过钩子观察会话,创建置信度评分的原子本能,并将其进化为技能/命令/代理。v2.1版本增加了项目范围的本能,以防止跨项目污染。
origin: ECC
version: 2.0.0
version: 2.1.0
---
# 持续学习 v2 - 基于本能的架构
# 持续学习 v2.1 - 基于本能
的架构
一个高级学习系统,通过原子化的“本能”——带有置信度评分的小型习得行为——将你的 Claude Code 会话转化为可重用的知识。
部分灵感来源于 humanplane (credit: @humanplane) 的 Homunculus 项目
**v2.1** 新增了**项目作用域的本能** — React 模式保留在你的 React 项目中Python 约定保留在你的 Python 项目中,而通用模式(如“始终验证输入”)则全局共享
## 何时激活
* 设置从 Claude Code 会话自动学习
* 通过钩子配置基于本能的行为提取
* 调整学习行为的置信度阈值
* 查、导出或导入本能库
* 将本能进化为完整技能、命令或代理
* 设置从 Claude Code 会话自动学习
* 通过钩子配置基于本能的行为提取
* 调整学习行为的置信度阈值
*、导出或导入本能库
* 将本能进化为完整技能、命令或代理
* 管理项目作用域与全局本能
* 将本能从项目作用域提升到全局作用域
## v2 的新特性
## v2.1 的新特性
| 特性 | v2.0 | v2.1 |
|---------|------|------|
| 存储 | 全局 (~/.claude/homunculus/) | 项目作用域 (projects/<hash>/) |
| 作用域 | 所有本能随处适用 | 项目作用域 + 全局 |
| 检测 | 无 | git remote URL / 仓库路径 |
| 提升 | 不适用 | 在 2+ 个项目中出现时,项目 → 全局 |
| 命令 | 4个 (status/evolve/export/import) | 6个 (+promote/projects) |
| 跨项目 | 存在污染风险 | 默认隔离 |
## v2 的新特性(对比 v1
| 特性 | v1 | v2 |
|---------|----|----|
| 观察 | 停止钩子(会话结束) | 工具使用前/后(100% 可靠 |
| 分析 | 主上下文 | 后台代理Haiku |
| 粒度 | 完整技能 | 原子化“本能” |
| 观察 | 停止钩子(会话结束) | PreToolUse/PostToolUse (100% 可靠) |
| 分析 | 主上下文 | 后台代理 (Haiku) |
| 粒度 | 完整技能 | 原子化“本能” |
| 置信度 | 无 | 0.3-0.9 加权 |
| 进 | 直接技能 | 本能 聚类 技能/命令/代理 |
| 进 | 直接进化为技能 | 本能 -> 聚类 -> 技能/命令/代理 |
| 共享 | 无 | 导出/导入本能 |
## 本能模型
@@ -41,6 +56,9 @@ trigger: "when writing new functions"
confidence: 0.7
domain: "code-style"
source: "session-observation"
scope: project
project_id: "a1b2c3d4e5f6"
project_name: "my-react-app"
---
# Prefer Functional Style
@@ -55,51 +73,69 @@ Use functional patterns over classes when appropriate.
**属性:**
* **原子** 一个触发条件,一个动作
* **置信度加权** 0.3 = 尝试性的0.9 = 乎确定
* **领域标记** 代码风格、测试、git、调试、工作流等
* **证据支持** 追踪是哪些观察创建了它
* **原子** -- 一个触发条件,一个动作
* **置信度加权** -- 0.3 = 试探性0.9 = 乎确定
* **领域标记** -- 代码风格、测试、git、调试、工作流等
* **证据支持** -- 追踪是哪些观察创建了它
* **作用域感知** -- `project` (默认) 或 `global`
## 工作原理
```
Session Activity
Hooks capture prompts + tool use (100% reliable)
┌─────────────────────────────────────────┐
│ observations.jsonl │
(prompts, tool calls, outcomes)
└─────────────────────────────────────────┘
│ Observer agent reads (background, Haiku)
┌─────────────────────────────────────────┐
│ PATTERN DETECTION │
│ • User corrections → instinct
• Error resolutions instinct
• Repeated workflows → instinct
└─────────────────────────────────────────┘
│ Creates/updates
┌─────────────────────────────────────────┐
instincts/personal/ │
│ • prefer-functional.md (0.7) │
│ • always-test-first.md (0.9) │
• use-zod-validation.md (0.6)
└─────────────────────────────────────────┘
│ /evolve clusters
┌─────────────────────────────────────────┐
│ evolved/ │
• commands/new-feature.md │
│ • skills/testing-workflow.md │
• agents/refactor-specialist.md │
└─────────────────────────────────────────┘
Session Activity (in a git repo)
|
| Hooks capture prompts + tool use (100% reliable)
| + detect project context (git remote / repo path)
v
+---------------------------------------------+
| projects/<project-hash>/observations.jsonl |
| (prompts, tool calls, outcomes, project) |
+---------------------------------------------+
|
| Observer agent reads (background, Haiku)
v
+---------------------------------------------+
| PATTERN DETECTION |
| * User corrections -> instinct |
| * Error resolutions -> instinct |
| * Repeated workflows -> instinct |
| * Scope decision: project or global? |
+---------------------------------------------+
|
| Creates/updates
v
+---------------------------------------------+
| projects/<project-hash>/instincts/personal/ |
| * prefer-functional.yaml (0.7) [project] |
| * use-react-hooks.yaml (0.9) [project] |
+---------------------------------------------+
| instincts/personal/ (GLOBAL) |
| * always-validate-input.yaml (0.85) [global]|
| * grep-before-edit.yaml (0.6) [global] |
+---------------------------------------------+
|
| /evolve clusters + /promote
v
+---------------------------------------------+
| projects/<hash>/evolved/ (project-scoped) |
| evolved/ (global) |
| * commands/new-feature.md |
| * skills/testing-workflow.md |
| * agents/refactor-specialist.md |
+---------------------------------------------+
```
## 项目检测
系统会自动检测您当前的项目:
1. **`CLAUDE_PROJECT_DIR` 环境变量** (最高优先级)
2. **`git remote get-url origin`** -- 哈希化以创建可移植的项目 ID (同一仓库在不同机器上获得相同的 ID)
3. **`git rev-parse --show-toplevel`** -- 使用仓库路径作为后备方案 (机器特定)
4. **全局后备方案** -- 如果未检测到项目,本能将进入全局作用域
每个项目都会获得一个 12 字符的哈希 ID (例如 `a1b2c3d4e5f6`)。`~/.claude/homunculus/projects.json` 处的注册表文件将 ID 映射到人类可读的名称。
## 快速开始
### 1. 启用观察钩子
@@ -115,14 +151,14 @@ Session Activity
"matcher": "*",
"hooks": [{
"type": "command",
"command": "${CLAUDE_PLUGIN_ROOT}/skills/continuous-learning-v2/hooks/observe.sh pre"
"command": "${CLAUDE_PLUGIN_ROOT}/skills/continuous-learning-v2/hooks/observe.sh"
}]
}],
"PostToolUse": [{
"matcher": "*",
"hooks": [{
"type": "command",
"command": "${CLAUDE_PLUGIN_ROOT}/skills/continuous-learning-v2/hooks/observe.sh post"
"command": "${CLAUDE_PLUGIN_ROOT}/skills/continuous-learning-v2/hooks/observe.sh"
}]
}]
}
@@ -138,14 +174,14 @@ Session Activity
"matcher": "*",
"hooks": [{
"type": "command",
"command": "~/.claude/skills/continuous-learning-v2/hooks/observe.sh pre"
"command": "~/.claude/skills/continuous-learning-v2/hooks/observe.sh"
}]
}],
"PostToolUse": [{
"matcher": "*",
"hooks": [{
"type": "command",
"command": "~/.claude/skills/continuous-learning-v2/hooks/observe.sh post"
"command": "~/.claude/skills/continuous-learning-v2/hooks/observe.sh"
}]
}]
}
@@ -154,93 +190,125 @@ Session Activity
### 2. 初始化目录结构
Python CLI 会自动创建这些目录,但也可以手动创建:
系统会在首次使用时自动创建目录,但也可以手动创建:
```bash
mkdir -p ~/.claude/homunculus/{instincts/{personal,inherited},evolved/{agents,skills,commands}}
touch ~/.claude/homunculus/observations.jsonl
# Global directories
mkdir -p ~/.claude/homunculus/{instincts/{personal,inherited},evolved/{agents,skills,commands},projects}
# Project directories are auto-created when the hook first runs in a git repo
```
### 3. 使用本能命令
```bash
/instinct-status # Show learned instincts with confidence scores
/instinct-status # Show learned instincts (project + global)
/evolve # Cluster related instincts into skills/commands
/instinct-export # Export instincts for sharing
/instinct-export # Export instincts to file
/instinct-import # Import instincts from others
/promote # Promote project instincts to global scope
/projects # List all known projects and their instinct counts
```
## 命令
| 命令 | 描述 |
|---------|-------------|
| `/instinct-status` | 显示所有已习得的本能及其置信度 |
| `/evolve` | 将相关本能聚类技能/命令 |
| `/instinct-export` | 导出本能用于共享 |
| `/instinct-import <file>` | 从他人处导入本能 |
| `/instinct-status` | 显示所有本能 (项目作用域 + 全局) 及其置信度 |
| `/evolve` | 将相关本能聚类技能/命令,建议提升 |
| `/instinct-export` | 导出本能 (可按作用域/领域过滤) |
| `/instinct-import <file>` | 导入本能 (带作用域控制) |
| `/promote [id]` | 将项目本能提升到全局作用域 |
| `/projects` | 列出所有已知项目及其本能数量 |
## 配置
编辑 `config.json`
编辑 `config.json` 以控制后台观察器
```json
{
"version": "2.0",
"observation": {
"enabled": true,
"store_path": "~/.claude/homunculus/observations.jsonl",
"max_file_size_mb": 10,
"archive_after_days": 7
},
"instincts": {
"personal_path": "~/.claude/homunculus/instincts/personal/",
"inherited_path": "~/.claude/homunculus/instincts/inherited/",
"min_confidence": 0.3,
"auto_approve_threshold": 0.7,
"confidence_decay_rate": 0.05
},
"version": "2.1",
"observer": {
"enabled": true,
"model": "haiku",
"enabled": false,
"run_interval_minutes": 5,
"patterns_to_detect": [
"user_corrections",
"error_resolutions",
"repeated_workflows",
"tool_preferences"
]
},
"evolution": {
"cluster_threshold": 3,
"evolved_path": "~/.claude/homunculus/evolved/"
"min_observations_to_analyze": 20
}
}
```
| 键 | 默认值 | 描述 |
|-----|---------|-------------|
| `observer.enabled` | `false` | 启用后台观察器代理 |
| `observer.run_interval_minutes` | `5` | 观察器分析观察结果的频率 |
| `observer.min_observations_to_analyze` | `20` | 运行分析所需的最小观察次数 |
其他行为 (观察捕获、本能阈值、项目作用域、提升标准) 通过 `instinct-cli.py``observe.sh` 中的代码默认值进行配置。
## 文件结构
```
~/.claude/homunculus/
├── identity.json # Your profile, technical level
├── observations.jsonl # Current session observations
├── observations.archive/ # Processed observations
├── instincts/
├── personal/ # Auto-learned instincts
└── inherited/ # Imported from others
└── evolved/
├── agents/ # Generated specialist agents
├── skills/ # Generated skills
└── commands/ # Generated commands
+-- identity.json # Your profile, technical level
+-- projects.json # Registry: project hash -> name/path/remote
+-- observations.jsonl # Global observations (fallback)
+-- instincts/
| +-- personal/ # Global auto-learned instincts
| +-- inherited/ # Global imported instincts
+-- evolved/
| +-- agents/ # Global generated agents
| +-- skills/ # Global generated skills
| +-- commands/ # Global generated commands
+-- projects/
+-- a1b2c3d4e5f6/ # Project hash (from git remote URL)
| +-- observations.jsonl
| +-- observations.archive/
| +-- instincts/
| | +-- personal/ # Project-specific auto-learned
| | +-- inherited/ # Project-specific imported
| +-- evolved/
| +-- skills/
| +-- commands/
| +-- agents/
+-- f6e5d4c3b2a1/ # Another project
+-- ...
```
## 与技能创建器的集成
## 作用域决策指南
当你使用 [技能创建器 GitHub 应用](https://skill-creator.app) 时,它现在会生成**两者**
| 模式类型 | 作用域 | 示例 |
|-------------|-------|---------|
| 语言/框架约定 | **项目** | "使用 React hooks", "遵循 Django REST 模式" |
| 文件结构偏好 | **项目** | "测试放在 `__tests__`/", "组件放在 src/components/" |
| 代码风格 | **项目** | "使用函数式风格", "首选数据类" |
| 错误处理策略 | **项目** | "对错误使用 Result 类型" |
| 安全实践 | **全局** | "验证用户输入", "清理 SQL" |
| 通用最佳实践 | **全局** | "先写测试", "始终处理错误" |
| 工具工作流偏好 | **全局** | "编辑前先 Grep", "写入前先读取" |
| Git 实践 | **全局** | "约定式提交", "小而专注的提交" |
* 传统的 SKILL.md 文件(用于向后兼容)
* 本能集合(用于 v2 学习系统)
## 本能提升 (项目 -> 全局)
来自仓库分析的本能带有 `source: "repo-analysis"` 标记,并包含源仓库 URL
当同一个本能在多个项目中以高置信度出现时,它就有资格被提升到全局作用域
**自动提升标准:**
* 相同的本能 ID 出现在 2+ 个项目中
* 平均置信度 >= 0.8
**如何提升:**
```bash
# Promote a specific instinct
python3 instinct-cli.py promote prefer-explicit-errors
# Auto-promote all qualifying instincts
python3 instinct-cli.py promote
# Preview without changes
python3 instinct-cli.py promote --dry-run
```
`/evolve` 命令也会建议可提升的候选本能。
## 置信度评分
@@ -267,7 +335,7 @@ touch ~/.claude/homunculus/observations.jsonl
## 为什么用钩子而非技能进行观察?
> v1 依赖技能进行观察。技能是概率性的——它们基于 Claude 的判断,大约有 50-80% 的概率触发。”
> "v1 依赖技能观察。技能是概率性的 -- 根据 Claude 的判断,它们触发的概率约为 50-80%。"
钩子**100% 触发**,是确定性的。这意味着:
@@ -277,18 +345,20 @@ touch ~/.claude/homunculus/observations.jsonl
## 向后兼容性
v2 v1 完全兼容:
v2.1 与 v2.0 和 v1 完全兼容:
* 现有的 `~/.claude/skills/learned/` 技能仍然有效
* 停止钩子仍然运行(但现在也输入到 v2
* 渐进式迁移路径:并行运行两者
* `~/.claude/homunculus/instincts/` 中现有的全局本能仍然作为全局本能工作
* 来自 v1 的现有 `~/.claude/skills/learned/` 技能仍然有效
* 停止钩子仍然运行 (但现在也会输入到 v2)
* 逐步迁移:并行运行两者
## 隐私
* 观察数据**保留在**你的本地机器上
* 只有**本能**(模式)可以被导出
* 观察结果**本地**保留在您的机器上
* 项目作用域的本能按项目隔离
* 只有**本能** (模式) 可以被导出 — 而不是原始观察数据
* 不会共享实际的代码或对话内容
* 控制导出的内容
* 控制导出和提升的内容
## 相关链接
@@ -298,4 +368,4 @@ v2 与 v1 完全兼容:
***
*基于本能的学习:一次一个观察,教会 Claude 的模式。*
*基于本能的学习:一次一个项目,教会 Claude 的模式。*

View File

@@ -1,8 +1,7 @@
---
name: observer
description: 背景代理,通过分析会话观察检测模式并创建本能。使用俳句以实现成本效益
description: 分析会话观察检测模式并创建本能的背景代理。使用Haiku以实现成本效益。v2.1版本增加了项目范围的本能
model: haiku
run_mode: background
---
# Observer Agent
@@ -11,20 +10,22 @@ run_mode: background
## 何时运行
*显著会话活动后20+ 工具调用
* 当用户运行 `/analyze-patterns`
* 按计划间隔(可配置,默认 5 分钟)
* 当被观察钩子触发时 (SIGUSR1)
*积累足够多的观察后(可配置,默认 20 条
* 在计划的时间间隔(可配置,默认 5 分钟)
* 当通过向观察者进程发送 SIGUSR1 信号手动触发时
## 输入
`~/.claude/homunculus/observations.jsonl` 读取观察结果
**项目作用域**的观察文件中读取观察记录
* 项目:`~/.claude/homunculus/projects/<project-hash>/observations.jsonl`
* 全局后备:`~/.claude/homunculus/observations.jsonl`
```jsonl
{"timestamp":"2025-01-22T10:30:00Z","event":"tool_start","session":"abc123","tool":"Edit","input":"..."}
{"timestamp":"2025-01-22T10:30:01Z","event":"tool_complete","session":"abc123","tool":"Edit","output":"..."}
{"timestamp":"2025-01-22T10:30:05Z","event":"tool_start","session":"abc123","tool":"Bash","input":"npm test"}
{"timestamp":"2025-01-22T10:30:10Z","event":"tool_complete","session":"abc123","tool":"Bash","output":"All tests pass"}
{"timestamp":"2025-01-22T10:30:00Z","event":"tool_start","session":"abc123","tool":"Edit","input":"...","project_id":"a1b2c3d4e5f6","project_name":"my-react-app"}
{"timestamp":"2025-01-22T10:30:01Z","event":"tool_complete","session":"abc123","tool":"Edit","output":"...","project_id":"a1b2c3d4e5f6","project_name":"my-react-app"}
{"timestamp":"2025-01-22T10:30:05Z","event":"tool_start","session":"abc123","tool":"Bash","input":"npm test","project_id":"a1b2c3d4e5f6","project_name":"my-react-app"}
{"timestamp":"2025-01-22T10:30:10Z","event":"tool_complete","session":"abc123","tool":"Bash","output":"All tests pass","project_id":"a1b2c3d4e5f6","project_name":"my-react-app"}
```
## 模式检测
@@ -73,28 +74,76 @@ run_mode: background
## 输出
`~/.claude/homunculus/instincts/personal/` 中创建/更新本能:
**项目作用域**的本能目录中创建/更新本能:
* 项目:`~/.claude/homunculus/projects/<project-hash>/instincts/personal/`
* 全局:`~/.claude/homunculus/instincts/personal/`(用于通用模式)
### 项目作用域本能(默认)
```yaml
---
id: prefer-grep-before-edit
trigger: "when searching for code to modify"
id: use-react-hooks-pattern
trigger: "when creating React components"
confidence: 0.65
domain: "workflow"
domain: "code-style"
source: "session-observation"
scope: project
project_id: "a1b2c3d4e5f6"
project_name: "my-react-app"
---
# Prefer Grep Before Edit
# Use React Hooks Pattern
## Action
Always use Grep to find the exact location before using Edit.
Always use functional components with hooks instead of class components.
## Evidence
- Observed 8 times in session abc123
- Pattern: Grep → Read → Edit sequence
- Pattern: All new components use useState/useEffect
- Last observed: 2025-01-22
```
### 全局本能(通用模式)
```yaml
---
id: always-validate-user-input
trigger: "when handling user input"
confidence: 0.75
domain: "security"
source: "session-observation"
scope: global
---
# Always Validate User Input
## Action
Validate and sanitize all user input before processing.
## Evidence
- Observed across 3 different projects
- Pattern: User consistently adds input validation
- Last observed: 2025-01-22
```
## 作用域决策指南
创建本能时,请根据以下经验法则确定其作用域:
| 模式类型 | 作用域 | 示例 |
|-------------|-------|---------|
| 语言/框架约定 | **项目** | "使用 React hooks"、"遵循 Django REST 模式" |
| 文件结构偏好 | **项目** | "测试在 `__tests__`/"、"组件在 src/components/" |
| 代码风格 | **项目** | "使用函数式风格"、"首选数据类" |
| 错误处理策略 | **项目**(通常) | "使用 Result 类型处理错误" |
| 安全实践 | **全局** | "验证用户输入"、"清理 SQL" |
| 通用最佳实践 | **全局** | "先写测试"、"始终处理错误" |
| 工具工作流偏好 | **全局** | "编辑前先 Grep"、"写之前先读" |
| Git 实践 | **全局** | "约定式提交"、"小而专注的提交" |
**如果不确定,默认选择 `scope: project`** — 先设为项目作用域,之后再提升,这比污染全局空间更安全。
## 置信度计算
基于观察频率的初始置信度:
@@ -110,35 +159,49 @@ Always use Grep to find the exact location before using Edit.
* 每次矛盾性观察 -0.1
* 每周无观察 -0.02(衰减)
## 本能提升(项目 → 全局)
当一个本能满足以下条件时,应从项目作用域提升到全局:
1. **相同模式**(通过 id 或类似触发器)存在于 **2 个以上不同的项目**中
2. 每个实例的置信度 **>= 0.8**
3. 其领域属于全局友好列表(安全、通用最佳实践、工作流)
提升操作由 `instinct-cli.py promote` 命令或 `/evolve` 分析处理。
## 重要准则
1. **保持保守**仅为清晰模式3+ 次观察)创建本能
1. **保持保守**只为明确的模式3 次以上观察)创建本能
2. **保持具体**:狭窄的触发器优于宽泛的触发器
3. **踪证据**:始终包含导致本能的观察结果
4. **尊重隐私**绝不包含实际代码片段,只包含模式
5. **合并相似项**:如果新本能与现有本能相似,则更新而非重复
3. **踪证据**:始终包含导致本能的观察记录
4. **尊重隐私**切勿包含实际代码片段,只包含模式
5. **合并相似项**:如果新本能与现有本能相似,则更新而非重复创建
6. **默认项目作用域**:除非模式明显是通用的,否则设为项目作用域
7. **包含项目上下文**:对于项目作用域的本能,始终设置 `project_id``project_name`
## 示例分析会话
给定观察结果:
```jsonl
{"event":"tool_start","tool":"Grep","input":"pattern: useState"}
{"event":"tool_complete","tool":"Grep","output":"Found in 3 files"}
{"event":"tool_start","tool":"Read","input":"src/hooks/useAuth.ts"}
{"event":"tool_complete","tool":"Read","output":"[file content]"}
{"event":"tool_start","tool":"Edit","input":"src/hooks/useAuth.ts..."}
{"event":"tool_start","tool":"Grep","input":"pattern: useState","project_id":"a1b2c3","project_name":"my-app"}
{"event":"tool_complete","tool":"Grep","output":"Found in 3 files","project_id":"a1b2c3","project_name":"my-app"}
{"event":"tool_start","tool":"Read","input":"src/hooks/useAuth.ts","project_id":"a1b2c3","project_name":"my-app"}
{"event":"tool_complete","tool":"Read","output":"[file content]","project_id":"a1b2c3","project_name":"my-app"}
{"event":"tool_start","tool":"Edit","input":"src/hooks/useAuth.ts...","project_id":"a1b2c3","project_name":"my-app"}
```
分析:
* 检测到工作流Grep → Read → Edit
* 频率:本次会话中到 5 次
* 检测到工作流Grep → Read → Edit
* 频率:本次会话中观察到 5 次
* **作用域决策**:这是一种通用工作流模式(非项目特定)→ **全局**
* 创建本能:
* 触发器:"when modifying code"
* 操作:"Search with Grep, confirm with Read, then Edit"
* 触发器:"当修改代码时"
* 操作:"用 Grep 搜索,用 Read 确认,然后 Edit"
* 置信度0.6
* 领域:"workflow"
* 作用域:"global"
## 与 Skill Creator 集成
@@ -146,5 +209,6 @@ Always use Grep to find the exact location before using Edit.
* `source: "repo-analysis"`
* `source_repo: "https://github.com/..."`
* `scope: "project"`(因为它们来自特定的仓库)
这些应被视为具有更高初始置信度0.7+)的团队/项目约定。

View File

@@ -117,4 +117,4 @@ Homunculus v2 采用了更复杂的方法:
4. **领域标记** - 代码风格、测试、git、调试等
5. **演进路径** - 将相关本能聚类为技能/命令
完整规格请参见:`docs/continuous-learning-v2-spec.md`
参见:`docs/continuous-learning-v2-spec.md` 以获取完整规范。

View File

@@ -161,7 +161,8 @@ include(FetchContent)
set(GTEST_VERSION v1.17.0) # Adjust to project policy.
FetchContent_Declare(
googletest
URL Google Test framework (official repository) https://github.com/google/googletest/archive/refs/tags/${GTEST_VERSION}.zip
# Google Test framework (official repository)
URL https://github.com/google/googletest/archive/refs/tags/${GTEST_VERSION}.zip
)
FetchContent_MakeAvailable(googletest)

View File

@@ -0,0 +1,52 @@
---
name: enterprise-agent-ops
description: 通过可观测性、安全边界和生命周期管理来操作长期运行的代理工作负载。
origin: ECC
---
# 企业级智能体运维
使用此技能用于需要超越单次 CLI 会话操作控制的云托管或持续运行的智能体系统。
## 运维领域
1. 运行时生命周期(启动、暂停、停止、重启)
2. 可观测性(日志、指标、追踪)
3. 安全控制(作用域、权限、紧急停止开关)
4. 变更管理(发布、回滚、审计)
## 基线控制
* 不可变的部署工件
* 最小权限凭证
* 环境级别的密钥注入
* 硬性超时和重试预算
* 高风险操作的审计日志
## 需跟踪的指标
* 成功率
* 每项任务的平均重试次数
* 恢复时间
* 每项成功任务的成本
* 故障类别分布
## 事故处理模式
当故障激增时:
1. 冻结新发布
2. 捕获代表性追踪数据
3. 隔离故障路径
4. 应用最小的安全变更进行修补
5. 运行回归测试 + 安全检查
6. 逐步恢复
## 部署集成
此技能可与以下工具配合使用:
* PM2 工作流
* systemd 服务
* 容器编排器
* CI/CD 门控

View File

@@ -267,3 +267,38 @@ npm test -- --testPathPattern="existing"
状态:可以发布
```
## 产品评估 (v1.8)
当单元测试无法单独捕获行为质量时,使用产品评估。
### 评分器类型
1. 代码评分器(确定性断言)
2. 规则评分器(正则表达式/模式约束)
3. 模型评分器LLM 作为评判者的评估准则)
4. 人工评分器(针对模糊输出的人工裁定)
### pass@k 指南
* `pass@1`:直接可靠性
* `pass@3`:受控重试下的实际可靠性
* `pass^3`:稳定性测试(所有 3 次运行必须通过)
推荐阈值:
* 能力评估pass@3 >= 0.90
* 回归评估对于发布关键路径pass^3 = 1.00
### 评估反模式
* 将提示过度拟合到已知的评估示例
* 仅测量正常路径输出
* 在追求通过率时忽略成本和延迟漂移
* 在发布关卡中允许不稳定的评分器
### 最小评估工件布局
* `.claude/evals/<feature>.md` 定义
* `.claude/evals/<feature>.log` 运行历史
* `docs/releases/<version>/eval-summary.md` 发布快照

View File

@@ -8,7 +8,7 @@ origin: ECC
创建零依赖、动画丰富的 HTML 演示文稿,完全在浏览器中运行。
灵感来源于 [zarazhangrui](https://github.com/zarazhangrui) 的作品中展示的视觉探索方法。
zarazhangrui(鸣谢:@zarazhangrui作品中展示的视觉探索方法的启发
## 何时启用

View File

@@ -0,0 +1,33 @@
---
name: nanoclaw-repl
description: 操作并扩展NanoClaw v2这是ECC基于claude -p构建的零依赖会话感知REPL。
origin: ECC
---
# NanoClaw REPL
在运行或扩展 `scripts/claw.js` 时使用此技能。
## 能力
* 持久的、基于 Markdown 的会话
* 使用 `/model` 进行模型切换
* 使用 `/load` 进行动态技能加载
* 使用 `/branch` 进行会话分支
* 使用 `/search` 进行跨会话搜索
* 使用 `/compact` 进行历史压缩
* 使用 `/export` 导出为 md/json/txt 格式
* 使用 `/metrics` 查看会话指标
## 操作指南
1. 保持会话聚焦于任务。
2. 在进行高风险更改前进行分支。
3. 在完成主要里程碑后进行压缩。
4. 在分享或存档前进行导出。
## 扩展规则
* 保持零外部运行时依赖
* 保持以 Markdown 作为数据库的兼容性
* 保持命令处理器的确定性和本地性

View File

@@ -0,0 +1,243 @@
---
name: plankton-code-quality
description: "使用Plankton进行编写时代码质量强制执行——通过钩子在每次文件编辑时自动格式化、代码检查和Claude驱动的修复。"
origin: community
---
# Plankton 代码质量技能
Plankton作者@alxfazio)的集成参考,这是一个用于 Claude Code 的编写时代码质量强制执行系统。Plankton 通过 PostToolUse 钩子在每次文件编辑时运行格式化程序和 linter然后生成 Claude 子进程来修复代理未捕获的违规。
## 何时使用
* 你希望每次文件编辑时都自动格式化和检查(不仅仅是提交时)
* 你需要防御代理修改 linter 配置以通过检查,而不是修复代码
* 你想要针对修复的分层模型路由(简单样式用 Haiku逻辑用 Sonnet类型用 Opus
* 你使用多种语言Python、TypeScript、Shell、YAML、JSON、TOML、Markdown、Dockerfile
## 工作原理
### 三阶段架构
每次 Claude Code 编辑或写入文件时Plankton 的 `multi_linter.sh` PostToolUse 钩子都会运行:
```
Phase 1: Auto-Format (Silent)
├─ Runs formatters (ruff format, biome, shfmt, taplo, markdownlint)
├─ Fixes 40-50% of issues silently
└─ No output to main agent
Phase 2: Collect Violations (JSON)
├─ Runs linters and collects unfixable violations
├─ Returns structured JSON: {line, column, code, message, linter}
└─ Still no output to main agent
Phase 3: Delegate + Verify
├─ Spawns claude -p subprocess with violations JSON
├─ Routes to model tier based on violation complexity:
│ ├─ Haiku: formatting, imports, style (E/W/F codes) — 120s timeout
│ ├─ Sonnet: complexity, refactoring (C901, PLR codes) — 300s timeout
│ └─ Opus: type system, deep reasoning (unresolved-attribute) — 600s timeout
├─ Re-runs Phase 1+2 to verify fixes
└─ Exit 0 if clean, Exit 2 if violations remain (reported to main agent)
```
### 主代理看到的内容
| 场景 | 代理看到 | 钩子退出码 |
|----------|-----------|-----------|
| 无违规 | 无 | 0 |
| 全部由子进程修复 | 无 | 0 |
| 子进程后仍存在违规 | `[hook] N violation(s) remain` | 2 |
| 建议性警告(重复项、旧工具) | `[hook:advisory] ...` | 0 |
主代理只看到子进程无法修复的问题。大多数质量问题都是透明解决的。
### 配置保护(防御规则博弈)
LLM 会修改 `.ruff.toml``biome.json` 来禁用规则而不是修复代码。Plankton 通过三层防御阻止这种行为:
1. **PreToolUse 钩子**`protect_linter_configs.sh` 在编辑发生前阻止对所有 linter 配置的修改
2. **Stop 钩子**`stop_config_guardian.sh` 在会话结束时通过 `git diff` 检测配置更改
3. **受保护文件列表**`.ruff.toml`, `biome.json`, `.shellcheckrc`, `.yamllint`, `.hadolint.yaml`
### 包管理器强制执行
Bash 上的 PreToolUse 钩子会阻止遗留包管理器:
* `pip`, `pip3`, `poetry`, `pipenv` → 被阻止(使用 `uv`
* `npm`, `yarn`, `pnpm` → 被阻止(使用 `bun`
* 允许的例外:`npm audit`, `npm view`, `npm publish`
## 设置
### 快速开始
```bash
# Clone Plankton into your project (or a shared location)
# Note: Plankton is by @alxfazio
git clone https://github.com/alexfazio/plankton.git
cd plankton
# Install core dependencies
brew install jaq ruff uv
# Install Python linters
uv sync --all-extras
# Start Claude Code — hooks activate automatically
claude
```
无需安装命令,无需插件配置。当你运行 Claude Code 时,`.claude/settings.json` 中的钩子会在 Plankton 目录中被自动拾取。
### 按项目集成
要在你自己的项目中使用 Plankton 钩子:
1.`.claude/hooks/` 目录复制到你的项目
2. 复制 `.claude/settings.json` 钩子配置
3. 复制 linter 配置文件(`.ruff.toml`, `biome.json` 等)
4. 为你使用的语言安装 linter
### 语言特定依赖
| 语言 | 必需 | 可选 |
|----------|----------|----------|
| Python | `ruff`, `uv` | `ty`(类型), `vulture`(死代码), `bandit`(安全) |
| TypeScript/JS | `biome` | `oxlint`, `semgrep`, `knip`(死导出) |
| Shell | `shellcheck`, `shfmt` | — |
| YAML | `yamllint` | — |
| Markdown | `markdownlint-cli2` | — |
| Dockerfile | `hadolint` (>= 2.12.0) | — |
| TOML | `taplo` | — |
| JSON | `jaq` | — |
## 与 ECC 配对使用
### 互补而非重叠
| 关注点 | ECC | Plankton |
|---------|-----|----------|
| 代码质量强制执行 | PostToolUse 钩子 (Prettier, tsc) | PostToolUse 钩子 (20+ linter + 子进程修复) |
| 安全扫描 | AgentShield, security-reviewer 代理 | Bandit (Python), Semgrep (TypeScript) |
| 配置保护 | — | PreToolUse 阻止 + Stop 钩子检测 |
| 包管理器 | 检测 + 设置 | 强制执行(阻止遗留包管理器) |
| CI 集成 | — | 用于 git 的 pre-commit 钩子 |
| 模型路由 | 手动 (`/model opus`) | 自动(违规复杂度 → 层级) |
### 推荐组合
1. 将 ECC 安装为你的插件(代理、技能、命令、规则)
2. 添加 Plankton 钩子以实现编写时质量强制执行
3. 使用 AgentShield 进行安全审计
4. 在 PR 之前使用 ECC 的 verification-loop 作为最后一道关卡
### 避免钩子冲突
如果同时运行 ECC 和 Plankton 钩子:
* ECC 的 Prettier 钩子和 Plankton 的 biome 格式化程序可能在 JS/TS 文件上冲突
* 解决方案:使用 Plankton 时禁用 ECC 的 Prettier PostToolUse 钩子Plankton 的 biome 更全面)
* 两者可以在不同的文件类型上共存ECC 处理 Plankton 未覆盖的内容)
## 配置参考
Plankton 的 `.claude/hooks/config.json` 控制所有行为:
```json
{
"languages": {
"python": true,
"shell": true,
"yaml": true,
"json": true,
"toml": true,
"dockerfile": true,
"markdown": true,
"typescript": {
"enabled": true,
"js_runtime": "auto",
"biome_nursery": "warn",
"semgrep": true
}
},
"phases": {
"auto_format": true,
"subprocess_delegation": true
},
"subprocess": {
"tiers": {
"haiku": { "timeout": 120, "max_turns": 10 },
"sonnet": { "timeout": 300, "max_turns": 10 },
"opus": { "timeout": 600, "max_turns": 15 }
},
"volume_threshold": 5
}
}
```
**关键设置:**
* 禁用你不使用的语言以加速钩子
* `volume_threshold` — 违规数量超过此值自动升级到更高的模型层级
* `subprocess_delegation: false` — 完全跳过第 3 阶段(仅报告违规)
## 环境变量覆盖
| 变量 | 目的 |
|----------|---------|
| `HOOK_SKIP_SUBPROCESS=1` | 跳过第 3 阶段,直接报告违规 |
| `HOOK_SUBPROCESS_TIMEOUT=N` | 覆盖层级超时时间 |
| `HOOK_DEBUG_MODEL=1` | 记录模型选择决策 |
| `HOOK_SKIP_PM=1` | 绕过包管理器强制执行 |
## 参考
* Plankton作者@alxfazio
* Plankton REFERENCE.md — 完整的架构文档(作者:@alxfazio
* Plankton SETUP.md — 详细的安装指南(作者:@alxfazio
## ECC v1.8 新增内容
### 可复制的钩子配置文件
设置严格的质量行为:
```bash
export ECC_HOOK_PROFILE=strict
export ECC_QUALITY_GATE_FIX=true
export ECC_QUALITY_GATE_STRICT=true
```
### 语言关卡表
* TypeScript/JavaScript首选 BiomePrettier 作为后备
* PythonRuff 格式/检查
* Gogofmt
### 配置篡改防护
在质量强制执行期间,标记同一迭代中对配置文件的更改:
* `biome.json`, `.eslintrc*`, `prettier.config*`, `tsconfig.json`, `pyproject.toml`
如果配置被更改以抑制违规,则要求在合并前进行明确审查。
### CI 集成模式
在 CI 中使用与本地钩子相同的命令:
1. 运行格式化程序检查
2. 运行 lint/类型检查
3. 严格模式下快速失败
4. 发布修复摘要
### 健康指标
跟踪:
* 被关卡标记的编辑
* 平均修复时间
* 按类别重复违规
* 因关卡失败导致的合并阻塞

View File

@@ -151,4 +151,4 @@ SELECT pg_reload_conf();
***
*基于 [Supabase Agent Skills](Supabase Agent Skills (credit: Supabase team)) (MIT License)*
*基于 Supabase 代理技能致谢Supabase 团队MIT 许可证)*

View File

@@ -0,0 +1,69 @@
---
name: ralphinho-rfc-pipeline
description: 基于RFC驱动的多智能体DAG执行模式包含质量门、合并队列和工作单元编排。
origin: ECC
---
# Ralphinho RFC 管道
灵感来源于 [humanplane](https://github.com/humanplane) 风格的 RFC 分解模式和多单元编排工作流。
当一个功能对于单次代理处理来说过于庞大,必须拆分为独立可验证的工作单元时,请使用此技能。
## 管道阶段
1. RFC 接收
2. DAG 分解
3. 单元分配
4. 单元实现
5. 单元验证
6. 合并队列与集成
7. 最终系统验证
## 单元规范模板
每个工作单元应包含:
* `id`
* `depends_on`
* `scope`
* `acceptance_tests`
* `risk_level`
* `rollback_plan`
## 复杂度层级
* 层级 1独立文件编辑确定性测试
* 层级 2多文件行为变更中等集成风险
* 层级 3架构/认证/性能/安全性变更
## 每个单元的质量管道
1. 研究
2. 实现计划
3. 实现
4. 测试
5. 审查
6. 合并就绪报告
## 合并队列规则
* 永不合并存在未解决依赖项失败的单元。
* 始终将单元分支变基到最新的集成分支上。
* 每次队列合并后重新运行集成测试。
## 恢复
如果一个单元停滞:
* 从活动队列中移除
* 快照发现结果
* 重新生成范围缩小的单元
* 使用更新的约束条件重试
## 输出
* RFC 执行日志
* 单元记分卡
* 依赖关系图快照
* 集成风险摘要

View File

@@ -62,10 +62,11 @@ origin: ECC
在编写实用程序或添加功能之前,在脑中过一遍:
1.是常见问题吗? → 搜索 npm/PyPI
2. 有相关的 MCP 吗? → 检查 `~/.claude/settings.json` 并搜索
3.相关的技能吗? → 检查 `~/.claude/skills/`
4. GitHub 模板吗? → 搜索 GitHub
0.已经在仓库中存在吗? → 首先通过相关模块/测试检查 `rg`
1. 这是一个常见问题吗? → 搜索 npm/PyPI
2.对应的 MCP 吗? → 检查 `~/.claude/settings.json` 并进行搜索
3.对应的技能吗? → 检查 `~/.claude/skills/`
4. 有 GitHub 上的实现/模板吗? → 在编写全新代码之前,先运行 GitHub 代码搜索以查找维护中的开源项目
### 完整模式(代理)

View File

@@ -136,8 +136,8 @@ alias claude-research='claude --system-prompt "$(cat ~/.claude/contexts/research
用 mgrep 替换 grep——与传统 grep 或 ripgrep 相比,平均减少约 50% 的令牌:
![mgrep Benchmark](../../assets/images/longform/06-mgrep-benchmark.png)
*在我们的 50 任务基准测试中mgrep + Claude Code 使用的 token 数比基于 grep 的工作流少约 2 倍且判断质量相似或更好。来源mgrep by @mixedbread-ai*
![mgrep 基准测试](../../assets/images/longform/06-mgrep-benchmark.png)
*在我们的 50 任务基准测试中mgrep + Claude Code 在相似或更好的判断质量下,使用的 token 数比基于 grep 的工作流少约 2 倍。来源:@mixedbread-ai 的 mgrep*
**模块化代码库的好处:**

View File

@@ -79,6 +79,12 @@ Located in `~/.claude/agents/`:
- 80% minimum coverage
- Unit + integration + E2E for critical flows
### Knowledge Capture
- Personal debugging notes, preferences, and temporary context → auto memory
- Team/project knowledge (architecture decisions, API changes, implementation runbooks) → follow the project's existing docs structure
- If the current task already produces the relevant docs, comments, or examples, do not duplicate the same knowledge elsewhere
- If there is no obvious project doc location, ask before creating a new top-level doc
---
## Editor Integration

View File

@@ -25,6 +25,7 @@ User request → Claude picks a tool → PreToolUse hook runs → Tool executes
| **Git push reminder** | `Bash` | Reminds to review changes before `git push` | 0 (warns) |
| **Doc file warning** | `Write` | Warns about non-standard `.md`/`.txt` files (allows README, CLAUDE, CONTRIBUTING, CHANGELOG, LICENSE, SKILL, docs/, skills/); cross-platform path handling | 0 (warns) |
| **Strategic compact** | `Edit\|Write` | Suggests manual `/compact` at logical intervals (every ~50 tool calls) | 0 (warns) |
| **InsAIts security monitor (opt-in)** | `Bash\|Write\|Edit\|MultiEdit` | Optional security scan for high-signal tool inputs. Disabled unless `ECC_ENABLE_INSAITS=1`. Blocks on critical findings, warns on non-critical, and writes audit log to `.insaits_audit_session.jsonl`. Requires `pip install insa-its`. [Details](../scripts/hooks/insaits-security-monitor.py) | 2 (blocks critical) / 0 (warns) |
### PostToolUse Hooks

View File

@@ -7,10 +7,10 @@
"hooks": [
{
"type": "command",
"command": "node \"${CLAUDE_PLUGIN_ROOT}/scripts/hooks/run-with-flags.js\" \"pre:bash:dev-server-block\" \"scripts/hooks/pre-bash-dev-server-block.js\" \"standard,strict\""
"command": "node \"${CLAUDE_PLUGIN_ROOT}/scripts/hooks/auto-tmux-dev.js\""
}
],
"description": "Block dev servers outside tmux - ensures you can access logs"
"description": "Auto-start dev servers in tmux with directory-based session names"
},
{
"matcher": "Bash",
@@ -63,6 +63,17 @@
}
],
"description": "Capture tool use observations for continuous learning"
},
{
"matcher": "Bash|Write|Edit|MultiEdit",
"hooks": [
{
"type": "command",
"command": "node \"${CLAUDE_PLUGIN_ROOT}/scripts/hooks/run-with-flags.js\" \"pre:insaits-security\" \"scripts/hooks/insaits-security-wrapper.js\" \"standard,strict\"",
"timeout": 15
}
],
"description": "Optional InsAIts AI security monitor for Bash/Edit/Write flows. Enable with ECC_ENABLE_INSAITS=1. Requires: pip install insa-its"
}
],
"PreCompact": [

View File

@@ -88,6 +88,11 @@
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-filesystem", "/path/to/your/projects"],
"description": "Filesystem operations (set your path)"
},
"insaits": {
"command": "python3",
"args": ["-m", "insa_its.mcp_server"],
"description": "AI-to-AI security monitoring — anomaly detection, credential exposure, hallucination checks, forensic tracing. 23 anomaly types, OWASP MCP Top 10 coverage. 100% local. Install: pip install insa-its"
}
},
"_comments": {

907
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -83,10 +83,13 @@
"postinstall": "echo '\\n ecc-universal installed!\\n Run: npx ecc-install typescript\\n Docs: https://github.com/affaan-m/everything-claude-code\\n'",
"lint": "eslint . && markdownlint '**/*.md' --ignore node_modules",
"claw": "node scripts/claw.js",
"test": "node scripts/ci/validate-agents.js && node scripts/ci/validate-commands.js && node scripts/ci/validate-rules.js && node scripts/ci/validate-skills.js && node scripts/ci/validate-hooks.js && node scripts/ci/validate-no-personal-paths.js && node tests/run-all.js"
"test": "node scripts/ci/validate-agents.js && node scripts/ci/validate-commands.js && node scripts/ci/validate-rules.js && node scripts/ci/validate-skills.js && node scripts/ci/validate-hooks.js && node scripts/ci/validate-no-personal-paths.js && node tests/run-all.js",
"coverage": "c8 --all --include=\"scripts/**/*.js\" --check-coverage --lines 80 --functions 80 --branches 80 --statements 80 --reporter=text --reporter=lcov node tests/run-all.js"
},
"devDependencies": {
"@eslint/js": "^9.39.2",
"ajv": "^8.18.0",
"c8": "^10.1.2",
"eslint": "^9.39.2",
"globals": "^17.1.0",
"markdownlint-cli": "^0.47.0"

View File

@@ -17,7 +17,8 @@ rules/
├── typescript/ # TypeScript/JavaScript specific
├── python/ # Python specific
├── golang/ # Go specific
── swift/ # Swift specific
── swift/ # Swift specific
└── php/ # PHP specific
```
- **common/** contains universal principles — no language-specific code examples.
@@ -33,6 +34,7 @@ rules/
./install.sh python
./install.sh golang
./install.sh swift
./install.sh php
# Install multiple languages at once
./install.sh typescript python
@@ -55,6 +57,7 @@ cp -r rules/typescript ~/.claude/rules/typescript
cp -r rules/python ~/.claude/rules/python
cp -r rules/golang ~/.claude/rules/golang
cp -r rules/swift ~/.claude/rules/swift
cp -r rules/php ~/.claude/rules/php
# Attention ! ! ! Configure according to your actual project requirements; the configuration here is for reference only.
```
@@ -88,7 +91,7 @@ To add support for a new language (e.g., `rust/`):
When language-specific rules and common rules conflict, **language-specific rules take precedence** (specific overrides general). This follows the standard layered configuration pattern (similar to CSS specificity or `.gitignore` precedence).
- `rules/common/` defines universal defaults applicable to all projects.
- `rules/golang/`, `rules/python/`, `rules/typescript/`, etc. override those defaults where language idioms differ.
- `rules/golang/`, `rules/python/`, `rules/swift/`, `rules/php/`, `rules/typescript/`, etc. override those defaults where language idioms differ.
### Example

View File

@@ -0,0 +1,86 @@
---
paths:
- "**/*.kt"
- "**/*.kts"
---
# Kotlin Coding Style
> This file extends [common/coding-style.md](../common/coding-style.md) with Kotlin-specific content.
## Formatting
- **ktlint** or **Detekt** for style enforcement
- Official Kotlin code style (`kotlin.code.style=official` in `gradle.properties`)
## Immutability
- Prefer `val` over `var` — default to `val` and only use `var` when mutation is required
- Use `data class` for value types; use immutable collections (`List`, `Map`, `Set`) in public APIs
- Copy-on-write for state updates: `state.copy(field = newValue)`
## Naming
Follow Kotlin conventions:
- `camelCase` for functions and properties
- `PascalCase` for classes, interfaces, objects, and type aliases
- `SCREAMING_SNAKE_CASE` for constants (`const val` or `@JvmStatic`)
- Prefix interfaces with behavior, not `I`: `Clickable` not `IClickable`
## Null Safety
- Never use `!!` — prefer `?.`, `?:`, `requireNotNull()`, or `checkNotNull()`
- Use `?.let {}` for scoped null-safe operations
- Return nullable types from functions that can legitimately have no result
```kotlin
// BAD
val name = user!!.name
// GOOD
val name = user?.name ?: "Unknown"
val name = requireNotNull(user) { "User must be set before accessing name" }.name
```
## Sealed Types
Use sealed classes/interfaces to model closed state hierarchies:
```kotlin
sealed interface UiState<out T> {
data object Loading : UiState<Nothing>
data class Success<T>(val data: T) : UiState<T>
data class Error(val message: String) : UiState<Nothing>
}
```
Always use exhaustive `when` with sealed types — no `else` branch.
## Extension Functions
Use extension functions for utility operations, but keep them discoverable:
- Place in a file named after the receiver type (`StringExt.kt`, `FlowExt.kt`)
- Keep scope limited — don't add extensions to `Any` or overly generic types
## Scope Functions
Use the right scope function:
- `let` — null check + transform: `user?.let { greet(it) }`
- `run` — compute a result using receiver: `service.run { fetch(config) }`
- `apply` — configure an object: `builder.apply { timeout = 30 }`
- `also` — side effects: `result.also { log(it) }`
- Avoid deep nesting of scope functions (max 2 levels)
## Error Handling
- Use `Result<T>` or custom sealed types
- Use `runCatching {}` for wrapping throwable code
- Never catch `CancellationException` — always rethrow it
- Avoid `try-catch` for control flow
```kotlin
// BAD — using exceptions for control flow
val user = try { repository.getUser(id) } catch (e: NotFoundException) { null }
// GOOD — nullable return
val user: User? = repository.findUser(id)
```

146
rules/kotlin/patterns.md Normal file
View File

@@ -0,0 +1,146 @@
---
paths:
- "**/*.kt"
- "**/*.kts"
---
# Kotlin Patterns
> This file extends [common/patterns.md](../common/patterns.md) with Kotlin and Android/KMP-specific content.
## Dependency Injection
Prefer constructor injection. Use Koin (KMP) or Hilt (Android-only):
```kotlin
// Koin — declare modules
val dataModule = module {
single<ItemRepository> { ItemRepositoryImpl(get(), get()) }
factory { GetItemsUseCase(get()) }
viewModelOf(::ItemListViewModel)
}
// Hilt — annotations
@HiltViewModel
class ItemListViewModel @Inject constructor(
private val getItems: GetItemsUseCase
) : ViewModel()
```
## ViewModel Pattern
Single state object, event sink, one-way data flow:
```kotlin
data class ScreenState(
val items: List<Item> = emptyList(),
val isLoading: Boolean = false
)
class ScreenViewModel(private val useCase: GetItemsUseCase) : ViewModel() {
private val _state = MutableStateFlow(ScreenState())
val state = _state.asStateFlow()
fun onEvent(event: ScreenEvent) {
when (event) {
is ScreenEvent.Load -> load()
is ScreenEvent.Delete -> delete(event.id)
}
}
}
```
## Repository Pattern
- `suspend` functions return `Result<T>` or custom error type
- `Flow` for reactive streams
- Coordinate local + remote data sources
```kotlin
interface ItemRepository {
suspend fun getById(id: String): Result<Item>
suspend fun getAll(): Result<List<Item>>
fun observeAll(): Flow<List<Item>>
}
```
## UseCase Pattern
Single responsibility, `operator fun invoke`:
```kotlin
class GetItemUseCase(private val repository: ItemRepository) {
suspend operator fun invoke(id: String): Result<Item> {
return repository.getById(id)
}
}
class GetItemsUseCase(private val repository: ItemRepository) {
suspend operator fun invoke(): Result<List<Item>> {
return repository.getAll()
}
}
```
## expect/actual (KMP)
Use for platform-specific implementations:
```kotlin
// commonMain
expect fun platformName(): String
expect class SecureStorage {
fun save(key: String, value: String)
fun get(key: String): String?
}
// androidMain
actual fun platformName(): String = "Android"
actual class SecureStorage {
actual fun save(key: String, value: String) { /* EncryptedSharedPreferences */ }
actual fun get(key: String): String? = null /* ... */
}
// iosMain
actual fun platformName(): String = "iOS"
actual class SecureStorage {
actual fun save(key: String, value: String) { /* Keychain */ }
actual fun get(key: String): String? = null /* ... */
}
```
## Coroutine Patterns
- Use `viewModelScope` in ViewModels, `coroutineScope` for structured child work
- Use `stateIn(viewModelScope, SharingStarted.WhileSubscribed(5_000), initialValue)` for StateFlow from cold Flows
- Use `supervisorScope` when child failures should be independent
## Builder Pattern with DSL
```kotlin
class HttpClientConfig {
var baseUrl: String = ""
var timeout: Long = 30_000
private val interceptors = mutableListOf<Interceptor>()
fun interceptor(block: () -> Interceptor) {
interceptors.add(block())
}
}
fun httpClient(block: HttpClientConfig.() -> Unit): HttpClient {
val config = HttpClientConfig().apply(block)
return HttpClient(config)
}
// Usage
val client = httpClient {
baseUrl = "https://api.example.com"
timeout = 15_000
interceptor { AuthInterceptor(tokenProvider) }
}
```
## References
See skill: `kotlin-coroutines-flows` for detailed coroutine patterns.
See skill: `android-clean-architecture` for module and layer patterns.

82
rules/kotlin/security.md Normal file
View File

@@ -0,0 +1,82 @@
---
paths:
- "**/*.kt"
- "**/*.kts"
---
# Kotlin Security
> This file extends [common/security.md](../common/security.md) with Kotlin and Android/KMP-specific content.
## Secrets Management
- Never hardcode API keys, tokens, or credentials in source code
- Use `local.properties` (git-ignored) for local development secrets
- Use `BuildConfig` fields generated from CI secrets for release builds
- Use `EncryptedSharedPreferences` (Android) or Keychain (iOS) for runtime secret storage
```kotlin
// BAD
val apiKey = "sk-abc123..."
// GOOD — from BuildConfig (generated at build time)
val apiKey = BuildConfig.API_KEY
// GOOD — from secure storage at runtime
val token = secureStorage.get("auth_token")
```
## Network Security
- Use HTTPS exclusively — configure `network_security_config.xml` to block cleartext
- Pin certificates for sensitive endpoints using OkHttp `CertificatePinner` or Ktor equivalent
- Set timeouts on all HTTP clients — never leave defaults (which may be infinite)
- Validate and sanitize all server responses before use
```xml
<!-- res/xml/network_security_config.xml -->
<network-security-config>
<base-config cleartextTrafficPermitted="false" />
</network-security-config>
```
## Input Validation
- Validate all user input before processing or sending to API
- Use parameterized queries for Room/SQLDelight — never concatenate user input into SQL
- Sanitize file paths from user input to prevent path traversal
```kotlin
// BAD — SQL injection
@Query("SELECT * FROM items WHERE name = '$input'")
// GOOD — parameterized
@Query("SELECT * FROM items WHERE name = :input")
fun findByName(input: String): List<ItemEntity>
```
## Data Protection
- Use `EncryptedSharedPreferences` for sensitive key-value data on Android
- Use `@Serializable` with explicit field names — don't leak internal property names
- Clear sensitive data from memory when no longer needed
- Use `@Keep` or ProGuard rules for serialized classes to prevent name mangling
## Authentication
- Store tokens in secure storage, not in plain SharedPreferences
- Implement token refresh with proper 401/403 handling
- Clear all auth state on logout (tokens, cached user data, cookies)
- Use biometric authentication (`BiometricPrompt`) for sensitive operations
## ProGuard / R8
- Keep rules for all serialized models (`@Serializable`, Gson, Moshi)
- Keep rules for reflection-based libraries (Koin, Retrofit)
- Test release builds — obfuscation can break serialization silently
## WebView Security
- Disable JavaScript unless explicitly needed: `settings.javaScriptEnabled = false`
- Validate URLs before loading in WebView
- Never expose `@JavascriptInterface` methods that access sensitive data
- Use `WebViewClient.shouldOverrideUrlLoading()` to control navigation

128
rules/kotlin/testing.md Normal file
View File

@@ -0,0 +1,128 @@
---
paths:
- "**/*.kt"
- "**/*.kts"
---
# Kotlin Testing
> This file extends [common/testing.md](../common/testing.md) with Kotlin and Android/KMP-specific content.
## Test Framework
- **kotlin.test** for multiplatform (KMP) — `@Test`, `assertEquals`, `assertTrue`
- **JUnit 4/5** for Android-specific tests
- **Turbine** for testing Flows and StateFlow
- **kotlinx-coroutines-test** for coroutine testing (`runTest`, `TestDispatcher`)
## ViewModel Testing with Turbine
```kotlin
@Test
fun `loading state emitted then data`() = runTest {
val repo = FakeItemRepository()
repo.addItem(testItem)
val viewModel = ItemListViewModel(GetItemsUseCase(repo))
viewModel.state.test {
assertEquals(ItemListState(), awaitItem()) // initial state
viewModel.onEvent(ItemListEvent.Load)
assertTrue(awaitItem().isLoading) // loading
assertEquals(listOf(testItem), awaitItem().items) // loaded
}
}
```
## Fakes Over Mocks
Prefer hand-written fakes over mocking frameworks:
```kotlin
class FakeItemRepository : ItemRepository {
private val items = mutableListOf<Item>()
var fetchError: Throwable? = null
override suspend fun getAll(): Result<List<Item>> {
fetchError?.let { return Result.failure(it) }
return Result.success(items.toList())
}
override fun observeAll(): Flow<List<Item>> = flowOf(items.toList())
fun addItem(item: Item) { items.add(item) }
}
```
## Coroutine Testing
```kotlin
@Test
fun `parallel operations complete`() = runTest {
val repo = FakeRepository()
val result = loadDashboard(repo)
advanceUntilIdle()
assertNotNull(result.items)
assertNotNull(result.stats)
}
```
Use `runTest` — it auto-advances virtual time and provides `TestScope`.
## Ktor MockEngine
```kotlin
val mockEngine = MockEngine { request ->
when (request.url.encodedPath) {
"/api/items" -> respond(
content = Json.encodeToString(testItems),
headers = headersOf(HttpHeaders.ContentType, ContentType.Application.Json.toString())
)
else -> respondError(HttpStatusCode.NotFound)
}
}
val client = HttpClient(mockEngine) {
install(ContentNegotiation) { json() }
}
```
## Room/SQLDelight Testing
- Room: Use `Room.inMemoryDatabaseBuilder()` for in-memory testing
- SQLDelight: Use `JdbcSqliteDriver(JdbcSqliteDriver.IN_MEMORY)` for JVM tests
```kotlin
@Test
fun `insert and query items`() = runTest {
val driver = JdbcSqliteDriver(JdbcSqliteDriver.IN_MEMORY)
Database.Schema.create(driver)
val db = Database(driver)
db.itemQueries.insert("1", "Sample Item", "description")
val items = db.itemQueries.getAll().executeAsList()
assertEquals(1, items.size)
}
```
## Test Naming
Use backtick-quoted descriptive names:
```kotlin
@Test
fun `search with empty query returns all items`() = runTest { }
@Test
fun `delete item emits updated list without deleted item`() = runTest { }
```
## Test Organization
```
src/
├── commonTest/kotlin/ # Shared tests (ViewModel, UseCase, Repository)
├── androidUnitTest/kotlin/ # Android unit tests (JUnit)
├── androidInstrumentedTest/kotlin/ # Instrumented tests (Room, UI)
└── iosTest/kotlin/ # iOS-specific tests
```
Minimum test coverage: ViewModel + UseCase for every feature.

Some files were not shown because too many files have changed in this diff Show More