@pdxxxx/keel 2.0.1 → 2.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/ARCHITECTURE.md CHANGED
@@ -18,7 +18,7 @@ Keel assumes your coding tool (Claude Code, Codex, Cursor, OpenCode, Antigravity
18
18
  - `main.rs` / `cli.rs` — CLI parser (`-C/--root`, `--json`, clean single-line `stderr` diagnostics)
19
19
  - `mcp.rs` & `mcp_root.rs` — stdio JSON-RPC 2.0 MCP server (`2024-11-05`, 13 tools, per-call `root`, `initialize` `rootUri`/`workspaceFolders`, homeless-cwd write guard, `--lock-root`)
20
20
  - `init.rs` & `doctor.rs` — non-destructive `init`, template-only `update`, strict config & marker `doctor`
21
- - `rules.rs`, `tasks.rs`, `verify.rs`, `hotspots.rs`, `mem.rs`, `migrate.rs`, `ablate.rs`, `snapshot.rs`, `config.rs`, `git.rs`, `paths.rs`
21
+ - `rules.rs`, `tasks.rs`, `verify.rs`, `mem.rs`, `migrate.rs`, `ablate.rs`, `snapshot.rs`, `config.rs`, `git.rs`, `paths.rs`
22
22
  - `tests/` — real child-process CLI (`tests/cli.rs`) and stdio MCP (`tests/stdio.rs`) integration suites.
23
23
  - `npm/` — zero-dependency npm wrapper (`npm/install.js`, `npm/bin/keel.js`, `npm/test.mjs`).
24
24
  - `docs/` — standalone VitePress documentation site deployed to GitHub Pages.
@@ -50,6 +50,8 @@ Explain why this invariant exists.
50
50
  - `spec.md`: single living document for goals, non-goals, acceptance criteria, and decisions.
51
51
  - `research/`: optional persisted notes.
52
52
  - Archived tasks live under `.keel/tasks/archive/<id>/`. Task IDs with `..` or absolute paths are rejected.
53
+ - Creation replaces a leading date in the normalized slug with today's date and gives the slug body up to 48 characters. Atomic directory creation still resolves collisions with `-2`, `-3`, and so on.
54
+ - Only a `done` response includes `distillHint`. It recommends an executable verification gate or a path-scoped rule and may list up to three of the top Git hotspots, preferring matches in uncommitted changes and falling back to the latest commit. Git inspection is best effort; the hint is not part of `meta.json`.
53
55
 
54
56
  ### Verification gates (`.keel/config.yaml`)
55
57
 
@@ -83,7 +85,13 @@ Streaming, read-only scan across seven sources:
83
85
  - `gemini`: `~/.gemini/tmp/*/chats/*.json`
84
86
  - `custom`: directories in `.keel/config.yaml` (`memory.sources`) and `KEEL_MEM_DIRS`
85
87
 
86
- Supports `--scope project | all`: `project` restricts results to sessions matching the active repository path; `all` searches everything while boosting current-project matches.
88
+ `--scope project` restricts results to project matches. Search in `--scope all` adds the same 5-point boost to project hits, including Keel and custom documents. Search selects the highest-scoring turn per session before ranking the bounded top results. Unknown `source` values are errors.
89
+
90
+ Search ignores obvious search invocations and echoes of its current query in transcripts. CLI `--exclude-session <ID>` (repeatable) and MCP `excludeSession` match a full ID, an ID suffix, or part of a transcript filename stem. Unless `--include-active` / `includeActive` is set, search also excludes transcripts matched by nonempty `KEEL_MEM_EXCLUDE_SESSION`, `CLAUDE_SESSION_ID`, or `CODEX_THREAD_ID`. These filters are search-only; `mem show` still reads the original turns.
91
+
92
+ ### Managed guidance
93
+
94
+ `init` upserts the Keel block in `AGENTS.md` and an existing `CLAUDE.md`; `init --claude` also creates a missing `CLAUDE.md`. `update` refreshes the Claude file only if it already has the block, including in previews. Edits preserve the surrounding prose and newline style. `doctor` checks both files for malformed, unpaired, or overlapping markers when a Keel block is present, and requires the block in `AGENTS.md`.
87
95
 
88
96
  ### External SHA-256 snapshots (`src/snapshot.rs`)
89
97
 
@@ -91,7 +99,7 @@ Supports `--scope project | all`: `project` restricts results to sessions matchi
91
99
 
92
100
  1. Rejects symlinks anywhere along workspace or backup paths.
93
101
  2. Writes and SHA-256 verifies every backup file before mutating the repository.
94
- 3. Strips managed blocks in `AGENTS.md` / `CLAUDE.md` and Trellis hooks in JSON settings without disturbing unrelated user content.
102
+ 3. Ablation strips Keel blocks in `AGENTS.md` and `CLAUDE.md` (removing files that become empty). Migration cleanup preserves Keel blocks while stripping Trellis blocks and Trellis entries in JSON hook settings.
95
103
  4. Verifies every path against post-operation hashes before restoring (refusing conflicts unless `--force` is passed).
96
104
 
97
105
  ### Multi-repo MCP root resolution (`src/mcp_root.rs`)
package/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # Changelog
2
2
 
3
+ ## 2.1.0 - 2026-12-03
4
+
5
+ - Improved `keel mem search` relevance and live-session hygiene: equal project boost for `keel`/`custom` docs in `--scope all`, best-turn-per-session deduplication, command-echo filtering (including leading CLI options), `--exclude-session` / `excludeSession`, `--include-active` / `includeActive`, automatic active-session exclusion via environment variables, and explicit validation + MCP enum for `source`.
6
+ - Deduplicated leading `YYYY-MM-DD` date prefixes in `keel task create --slug` so today's date is prepended once and the full 48-character budget goes to the slug body.
7
+ - Added opt-in Claude Code repository guidance support (`keel init --claude`, automatic adoption of existing `CLAUDE.md`, `keel update` refresh, `keel doctor` marker checks, and transaction-safe `keel ablate` / `restore`).
8
+ - Added an ephemeral `distillHint` to `keel task done` / `keel_task_update(action: "done")` responses (highlighting up to three intersecting top-10 Git hotspots without writing to `meta.json`) and updated the managed guidance block to prompt distilling lessons into gates or rules.
9
+
3
10
  ## 2.0.1 - 2026-11-24
4
11
 
5
12
  - Embedded `assets/keel.ico` (16–256px) and Windows PE version metadata into `keel.exe` via `build.rs` and `winresource`.
package/README.md CHANGED
@@ -47,7 +47,7 @@ Prebuilt binaries for Linux (`x86_64`, `aarch64`), macOS (`arm64`, `x86_64`), an
47
47
 
48
48
  ```sh
49
49
  # 1. Initialize .keel/, AGENTS.md block, and standard .agents/skills/
50
- keel init
50
+ keel init # use keel init --claude to create a Claude Code entry file
51
51
 
52
52
  # 2. Record a path-scoped rule
53
53
  keel rules add auth-rotation \
@@ -68,8 +68,8 @@ keel verify --git
68
68
 
69
69
  ```sh
70
70
  keel hotspots # rank existing files by recent bugfix churn
71
- keel doctor # check config.yaml, AGENTS.md markers, git, and stale rules
72
- keel update # refresh AGENTS.md block & skills without touching config.yaml
71
+ keel doctor # check config, managed markers, git, and stale rules
72
+ keel update --dry-run # preview updates to managed blocks and skills
73
73
  keel migrate scan # inventory Trellis, .cursorrules, CLAUDE.md, etc.
74
74
  keel migrate cleanup --dry-run # preview safe removal (backed up; undo with `keel migrate rollback`)
75
75
  ```
@@ -80,18 +80,20 @@ Global flags: `-C, --root <PATH>` and `--json`.
80
80
 
81
81
  | Command | Description |
82
82
  | --- | --- |
83
- | `keel init` | Creates `.keel/`, detects project scripts, updates `AGENTS.md`, installs 5 skills (never overwrites `config.yaml` unless `--reset-config`). |
84
- | `keel update` | Safely refreshes managed templates (`AGENTS.md` block, `rules/index.md`, `keel-*` skills) without touching user config, rules, or tasks. |
85
- | `keel doctor` | Validates `.keel/config.yaml` strictly, checks `AGENTS.md` markers, `git`, and stale rules. |
83
+ | `keel init` | Creates `.keel/`, detects scripts, installs 5 skills, and updates `AGENTS.md` and any existing `CLAUDE.md`. Pass `--claude` to create `CLAUDE.md` if missing; `--reset-config` to replace existing config. |
84
+ | `keel update` | Refreshes managed blocks and templates; use `--dry-run` to preview. |
85
+ | `keel doctor` | Validates `.keel/config.yaml`, managed `AGENTS.md` and `CLAUDE.md` markers, `git`, and stale rules. |
86
86
  | `keel rules` | `list`, `match [paths...] [--git \| --staged \| --base <ref>]`, `add <id>`, `check [--stale \| --strict]`. |
87
- | `keel task` | `create`, `list`, `show`, `done`, `reopen`, `archive` — optional single-file `spec.md` per task. |
87
+ | `keel task` | `create`, `list`, `show`, `done`, `reopen`, `archive`. Task IDs use today's date, replacing any date prefix in the slug; `done` suggests a gate or rule and can name relevant Git hotspots. |
88
88
  | `keel verify` | Runs gates in `.keel/config.yaml` (`--gate`, `--git`, `--staged`, `--base <ref>`, `--fail-fast`) with timeout and output-cap protection. |
89
89
  | `keel hotspots` | Ranks existing files by recent churn and bugfix commits (`--commits`, `--limit`). |
90
90
  | `keel mem` | `sources`, `sessions`, `search`, `show` (`--scope project \| all`) across `.keel/`, Claude Code, Codex, OpenCode, Antigravity, Gemini, and custom dirs. |
91
91
  | `keel migrate` | `scan`, `plan`, `cleanup [--dry-run]`, `rollback` backed by SHA-256 external snapshots. |
92
- | `keel ablate` / `restore` | Temporarily removes Keel surfaces for A/B benchmarking and restores byte-for-byte. |
92
+ | `keel ablate` / `restore` | Temporarily removes Keel surfaces, including the managed blocks in both guidance files, and restores byte-for-byte. |
93
93
  | `keel mcp` | Starts the stdio MCP server (13 tools, multi-repo per-call `root`, optional `--lock-root`). |
94
94
 
95
+ `keel mem search` returns the best match per session and boosts all project matches in `--scope all`. Use `--source keel` for `.keel/` tasks and rules; unknown sources are errors. Search skips command echoes and excludes active transcripts identified by `KEEL_MEM_EXCLUDE_SESSION`, `CLAUDE_SESSION_ID`, or `CODEX_THREAD_ID`. Pass `--include-active` to ignore those environment variables, or repeat `--exclude-session <ID>` to exclude specific sessions. Use `keel mem show <ID>` to read the transcript.
96
+
95
97
  ## MCP Server
96
98
 
97
99
  A single `keel mcp` process can serve multiple repositories safely (including behind MCP hubs/aggregators). Every tool accepts an optional `root` argument as highest priority.
@@ -117,6 +119,8 @@ codex mcp add keel -- keel mcp
117
119
 
118
120
  Pass `--root <path> --lock-root` if you want to pin an instance to a single repository.
119
121
 
122
+ `keel_mem_search` accepts `excludeSession` and `includeActive`. `keel_task_update` with `action: "done"` returns `distillHint` without writing it to `meta.json`.
123
+
120
124
  <details>
121
125
  <summary>Exposed MCP tools (13)</summary>
122
126
 
@@ -135,6 +139,7 @@ Pass `--root <path> --lock-root` if you want to pin an instance to a single repo
135
139
  rules/ # path-scoped markdown rules (YAML frontmatter)
136
140
  tasks/ # optional task specs (meta.json + spec.md)
137
141
  AGENTS.md # managed block (<!-- KEEL:START --> ... <!-- KEEL:END -->)
142
+ CLAUDE.md # optional Claude Code entry with the same managed block
138
143
  .agents/skills/ # keel-plan, keel-verify, keel-distill, keel-mem, keel-migrate
139
144
  ```
140
145
 
package/README_CN.md CHANGED
@@ -47,7 +47,7 @@ Linux(`x86_64`、`aarch64`)、macOS(`arm64`、`x86_64`)与 Windows(`x8
47
47
 
48
48
  ```sh
49
49
  # 1. 初始化 .keel/、AGENTS.md 托管块与标准 .agents/skills/
50
- keel init
50
+ keel init # 使用 Claude Code 时可加 --claude 创建入口文件
51
51
 
52
52
  # 2. 添加一条按路径生效的规则
53
53
  keel rules add auth-rotation \
@@ -68,8 +68,8 @@ keel verify --git
68
68
 
69
69
  ```sh
70
70
  keel hotspots # 找出高频修复文件,优先给暗坑补规则
71
- keel doctor # 检查 config.yaml 字段错误、AGENTS.md 标记、git 与失效规则
72
- keel update # 安全刷新 AGENTS.md 块与内置 skills,不动你的 config.yaml
71
+ keel doctor # 检查配置、托管标记、git 与失效规则
72
+ keel update --dry-run # 预览托管块和 skills 的更新
73
73
  keel migrate scan # 盘点 Trellis、.cursorrules、CLAUDE.md 等旧配置
74
74
  keel migrate cleanup --dry-run # 预览安全清理(自动备份,可 `keel migrate rollback` 回滚)
75
75
  ```
@@ -80,18 +80,20 @@ keel migrate cleanup --dry-run # 预览安全清理(自动备份,可 `keel
80
80
 
81
81
  | 命令 | 说明 |
82
82
  | --- | --- |
83
- | `keel init` | 创建 `.keel/`、自动探测校验脚本、更新 `AGENTS.md` 并安装 5 个标准 skills(除非显式 `--reset-config`,绝不覆盖已有 `config.yaml`)。 |
84
- | `keel update` | 安全刷新托管模板(`AGENTS.md` 块、`rules/index.md`、`keel-*` skills),不碰用户配置、规则和任务。 |
85
- | `keel doctor` | 严格校验 `.keel/config.yaml` 字段与类型、检查 `AGENTS.md` 标记、`git` 及过期规则。 |
83
+ | `keel init` | 创建 `.keel/`、探测脚本、安装 5 个标准 skills,更新 `AGENTS.md` 和已有的 `CLAUDE.md`。用 `--claude` 创建缺失的 `CLAUDE.md`,用 `--reset-config` 替换已有配置。 |
84
+ | `keel update` | 刷新托管块和模板,可用 `--dry-run` 预览。 |
85
+ | `keel doctor` | 严格检查 `.keel/config.yaml`、`AGENTS.md` 和 `CLAUDE.md` 的托管标记、`git` 及过期规则。 |
86
86
  | `keel rules` | `list`、`match [paths...] [--git \| --staged \| --base <ref>]`、`add <id>`、`check [--stale \| --strict]`。 |
87
- | `keel task` | `create`、`list`、`show`、`done`、`reopen`、`archive`,按需用单个 `spec.md` 记录复杂任务。 |
87
+ | `keel task` | `create`、`list`、`show`、`done`、`reopen`、`archive`。任务 ID 用当天日期替换 slug 自带的日期前缀;`done` 提示补门禁或规则,有交集时列出 Git 热点。 |
88
88
  | `keel verify` | 运行 `.keel/config.yaml` 中的门禁(支持 `--gate`、`--git`、`--staged`、`--base <ref>`、`--fail-fast`),自带超时强杀与输出截断。 |
89
89
  | `keel hotspots` | 按近期改动与 bugfix 频率列出高风险现存文件(`--commits`、`--limit`)。 |
90
90
  | `keel mem` | `sources`、`sessions`、`search`、`show`(支持 `--scope project \| all`),跨 `.keel/`、Claude Code、Codex、OpenCode、Antigravity、Gemini 与自定义目录流式检索。 |
91
91
  | `keel migrate` | `scan`、`plan`、`cleanup [--dry-run]`、`rollback`,由外部 SHA-256 快照保护。 |
92
- | `keel ablate` / `restore` | 临时移出 Keel 文件做 A/B 对比,随后逐字节无损恢复。 |
92
+ | `keel ablate` / `restore` | 临时移出 Keel 文件及两份入口文件里的托管块,随后逐字节恢复。 |
93
93
  | `keel mcp` | 启动 stdio MCP 服务(13 个工具,支持按次 `root` 切换多仓库与 `--lock-root`)。 |
94
94
 
95
+ `keel mem search` 每个会话只返回得分最高的一条;`--scope all` 给所有本仓库命中统一加权。查 `.keel/` 下的任务和规则用 `--source keel`,无效来源会报错。检索会跳过命令回显,并根据 `KEEL_MEM_EXCLUDE_SESSION`、`CLAUDE_SESSION_ID`、`CODEX_THREAD_ID` 排除当前会话。用 `--include-active` 关闭自动排除,用可重复的 `--exclude-session <ID>` 手动排除。查看会话原文用 `keel mem show <ID>`。
96
+
95
97
  ## MCP 接入
96
98
 
97
99
  单个常驻 `keel mcp` 进程即可安全服务多个仓库(完美适配 MCP 聚合服务)。全部 13 个工具均支持最高优先级可选参数 `root`。
@@ -117,6 +119,8 @@ codex mcp add keel -- keel mcp
117
119
 
118
120
  如需强制锁死在单个仓库目录,传入 `--root <path> --lock-root`。
119
121
 
122
+ `keel_mem_search` 支持 `excludeSession` 和 `includeActive`;`keel_task_update` 的 `action: "done"` 响应包含 `distillHint`,不会写进 `meta.json`。
123
+
120
124
  <details>
121
125
  <summary>暴露的 MCP 工具(13 个)</summary>
122
126
 
@@ -135,6 +139,7 @@ codex mcp add keel -- keel mcp
135
139
  rules/ # 带 YAML frontmatter 的按路径规则
136
140
  tasks/ # 可选任务目录(meta.json + spec.md)
137
141
  AGENTS.md # 托管块(<!-- KEEL:START --> ... <!-- KEEL:END -->)
142
+ CLAUDE.md # 可选 Claude Code 入口,使用相同的托管块
138
143
  .agents/skills/ # keel-plan, keel-verify, keel-distill, keel-mem, keel-migrate
139
144
  ```
140
145
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pdxxxx/keel",
3
- "version": "2.0.1",
3
+ "version": "2.1.0",
4
4
  "description": "Repo rules, task specs, session memory, and verification gates for coding agents.",
5
5
  "type": "module",
6
6
  "license": "MIT",