ECC
ECC 源码分析:追踪 Skills、Hooks、Memory 与适配器
从目录清单、生命周期事件、MCP 配置、持久化上下文和跨客户端适配器理解 ECC。

你将学会
- Trace ECC catalog and lifecycle events
- Evaluate adapter parity and MCP boundaries
- Design safe persisted-context tests
开始前需要
- Basic Git and command-line usage
- Comfort reading a project README
You can explain the project, run its documented first step, and decide what to verify before adopting it.
先看结论
- ECC's catalog mixes instructions, executable hooks, persisted state, and adapters.
- Lifecycle traces should expose approvals, writes, failures, and MCP boundaries.
- Adapter matrices and memory-retention tests are required for safe extensions.
Read the repository as a catalog
ECC 源码需要同时阅读目录清单、可执行 hooks、MCP 入口、记忆写入路径和客户端适配器。沿一个无害任务追踪权限、事件、生成文件和持久化状态,才能发现跨客户端差异与潜在泄漏。
The distinction matters for review. A markdown rule can alter model behavior, while a hook can execute a shell command or write state. Map both in the same dependency graph instead of reviewing prompts and code in isolation.
Trace one lifecycle event
Pick a harmless tool invocation and locate the hook registration, event payload, and post-tool action. Record command arguments, approval checks, environment variables, and any files written to memory or instincts. A useful implementation keeps event handling idempotent and makes failures visible to the operator.
MCP entries form another boundary: they connect the agent to external tools and services. Verify endpoint allow-lists, timeouts, authentication, and redaction before enabling an integration in a real repository.
Compare adapters instead of assuming parity
Cross-client support is implemented through adapters or generated files that translate the catalog into each host's format. Inspect one capability—such as a planning command or hook—and compare how Claude Code, Codex, Cursor, OpenCode, or another client exposes it. Missing lifecycle events should be represented as an explicit capability gap.
Keep an adapter matrix in tests. Assert generated paths, command names, hook order, and permission defaults so an upgrade cannot silently remove a guardrail while preserving the same filenames.
Persisted context is part of the threat model
Memory and instincts can improve future tasks, but they are durable inputs to later agent loops. Read the write path, schema, retention, and recall filters. Reject entries that contain credentials, private prompts, or repository-specific assumptions that could leak into another project.
The source-level extension rule is simple: preserve provenance for every generated artifact, event, and memory write. Add tests for clean uninstall, duplicate hook prevention, blocked commands, and redacted logs before shipping a new skill or adapter.
如何选择
| 比较维度 | 方案 A | 方案 B |
|---|---|---|
| Best when | You need predictable behavior and easy auditing | You need adaptive optimization and have reliable telemetry |
| Main risk | May leave performance on the table | Can become difficult to explain or debug |
实施步骤
- 1
Trace one command from catalog entry to host file.
- 2
Follow a harmless tool event through hook registration and memory writes.
- 3
Compare the same capability across two client adapters.
- 4
Add tests for redaction, duplicate hooks, blocked commands, and uninstall.
可复制示例
catalog command -> adapter file -> agent/tool call
-> lifecycle hook -> approval + event log -> scoped memory write常见问题
Are ECC markdown files harmless documentation?
Not always. Rules can change agent behavior and hooks can execute commands; review permissions and generated files together.
How can I detect cross-project memory leakage?
Use fixtures with distinct project markers, inspect recall filters, and assert that secrets or repository-specific prompts are rejected and redacted.
资料来源
- ECC README (captured 2026-08-31)来源核查 2026-08-31
- ECC repository来源核查 2026-08-31