mirror of
https://github.com/affaan-m/everything-claude-code.git
synced 2026-04-16 15:13:33 +08:00
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>
This commit is contained in:
@@ -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 回合和纯文本。
|
||||
|
||||
@@ -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`:除了分析输出外,还生成进化后的文件
|
||||
|
||||
## 生成的文件格式
|
||||
|
||||
|
||||
59
docs/zh-CN/commands/harness-audit.md
Normal file
59
docs/zh-CN/commands/harness-audit.md
Normal 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` (可选输出格式)
|
||||
@@ -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`)
|
||||
|
||||
@@ -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/
|
||||
|
||||
|
||||
@@ -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 格式输出,供编程使用
|
||||
|
||||
33
docs/zh-CN/commands/loop-start.md
Normal file
33
docs/zh-CN/commands/loop-start.md
Normal 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` 可选
|
||||
25
docs/zh-CN/commands/loop-status.md
Normal file
25
docs/zh-CN/commands/loop-status.md
Normal file
@@ -0,0 +1,25 @@
|
||||
# 循环状态命令
|
||||
|
||||
检查活动循环状态、进度和故障信号。
|
||||
|
||||
## 用法
|
||||
|
||||
`/loop-status [--watch]`
|
||||
|
||||
## 报告内容
|
||||
|
||||
* 活动循环模式
|
||||
* 当前阶段和最后一个成功的检查点
|
||||
* 失败的检查(如果有)
|
||||
* 预计的时间/成本偏差
|
||||
* 建议的干预措施(继续/暂停/停止)
|
||||
|
||||
## 监视模式
|
||||
|
||||
当 `--watch` 存在时,定期刷新状态并显示状态变化。
|
||||
|
||||
## 参数
|
||||
|
||||
$ARGUMENTS:
|
||||
|
||||
* `--watch` 可选
|
||||
27
docs/zh-CN/commands/model-route.md
Normal file
27
docs/zh-CN/commands/model-route.md
Normal file
@@ -0,0 +1,27 @@
|
||||
# 模型路由命令
|
||||
|
||||
根据任务复杂度和预算推荐最佳模型层级。
|
||||
|
||||
## 用法
|
||||
|
||||
`/model-route [task-description] [--budget low|med|high]`
|
||||
|
||||
## 路由启发式规则
|
||||
|
||||
* `haiku`: 确定性、低风险的机械性变更
|
||||
* `sonnet`: 实现和重构的默认选择
|
||||
* `opus`: 架构设计、深度评审、模糊需求
|
||||
|
||||
## 必需输出
|
||||
|
||||
* 推荐的模型
|
||||
* 置信度
|
||||
* 该模型适合的原因
|
||||
* 如果首次尝试失败,备用的回退模型
|
||||
|
||||
## 参数
|
||||
|
||||
$ARGUMENTS:
|
||||
|
||||
* `[task-description]` 可选,自由文本
|
||||
* `--budget low|med|high` 可选
|
||||
@@ -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:构思
|
||||
|
||||
@@ -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. **Task(Explore 代理)**:如需更广泛的探索,使用 `Task` 并设置 `subagent_type: “Explore”`
|
||||
3. **Read**:读取发现的文件以收集完整的上下文
|
||||
4. **Task (探索代理)**:对于更广泛的探索,使用 `Task` 和 `subagent_type: "Explore"`
|
||||
|
||||
**检索后**:
|
||||
|
||||
|
||||
@@ -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: 构思
|
||||
|
||||
|
||||
@@ -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. **Task(Explore 代理)**:如需更深入的探索,使用 `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 完整性检查
|
||||
|
||||
|
||||
@@ -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:解决方案构思
|
||||
|
||||
|
||||
39
docs/zh-CN/commands/projects.md
Normal file
39
docs/zh-CN/commands/projects.md
Normal 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. 同时显示全局本能总数
|
||||
41
docs/zh-CN/commands/promote.md
Normal file
41
docs/zh-CN/commands/promote.md
Normal 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`
|
||||
30
docs/zh-CN/commands/quality-gate.md
Normal file
30
docs/zh-CN/commands/quality-gate.md
Normal file
@@ -0,0 +1,30 @@
|
||||
# 质量门命令
|
||||
|
||||
按需对文件或项目范围运行 ECC 质量管道。
|
||||
|
||||
## 用法
|
||||
|
||||
`/quality-gate [path|.] [--fix] [--strict]`
|
||||
|
||||
* 默认目标:当前目录 (`.`)
|
||||
* `--fix`:在已配置的地方允许自动格式化/修复
|
||||
* `--strict`:在支持的地方警告即失败
|
||||
|
||||
## 管道
|
||||
|
||||
1. 检测目标的语言/工具。
|
||||
2. 运行格式化检查。
|
||||
3. 在可用时运行代码检查/类型检查。
|
||||
4. 生成简洁的修复列表。
|
||||
|
||||
## 备注
|
||||
|
||||
此命令镜像了钩子行为,但由操作员调用。
|
||||
|
||||
## 参数
|
||||
|
||||
$ARGUMENTS:
|
||||
|
||||
* `[path|.]` 可选的目标路径
|
||||
* `--fix` 可选
|
||||
* `--strict` 可选
|
||||
Reference in New Issue
Block a user