@pdxxxx/keel 1.1.0 → 2.0.1
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 +52 -47
- package/CHANGELOG.md +26 -15
- package/LICENSE +21 -21
- package/README.md +46 -47
- package/README_CN.md +49 -50
- package/npm/bin/keel.js +25 -0
- package/npm/install.js +55 -0
- package/package.json +6 -27
- package/bin/keel.js +0 -4
- package/dist/cli.d.ts +0 -3
- package/dist/cli.js +0 -569
- package/dist/cli.js.map +0 -1
- package/dist/core/ablate.d.ts +0 -11
- package/dist/core/ablate.js +0 -54
- package/dist/core/ablate.js.map +0 -1
- package/dist/core/config.d.ts +0 -3
- package/dist/core/config.js +0 -60
- package/dist/core/config.js.map +0 -1
- package/dist/core/git.d.ts +0 -9
- package/dist/core/git.js +0 -48
- package/dist/core/git.js.map +0 -1
- package/dist/core/glob.d.ts +0 -8
- package/dist/core/glob.js +0 -61
- package/dist/core/glob.js.map +0 -1
- package/dist/core/hotspots.d.ts +0 -11
- package/dist/core/hotspots.js +0 -49
- package/dist/core/hotspots.js.map +0 -1
- package/dist/core/init.d.ts +0 -14
- package/dist/core/init.js +0 -117
- package/dist/core/init.js.map +0 -1
- package/dist/core/mcp.d.ts +0 -24
- package/dist/core/mcp.js +0 -323
- package/dist/core/mcp.js.map +0 -1
- package/dist/core/mem.d.ts +0 -21
- package/dist/core/mem.js +0 -337
- package/dist/core/mem.js.map +0 -1
- package/dist/core/migrate.d.ts +0 -21
- package/dist/core/migrate.js +0 -207
- package/dist/core/migrate.js.map +0 -1
- package/dist/core/paths.d.ts +0 -14
- package/dist/core/paths.js +0 -44
- package/dist/core/paths.js.map +0 -1
- package/dist/core/rules.d.ts +0 -22
- package/dist/core/rules.js +0 -262
- package/dist/core/rules.js.map +0 -1
- package/dist/core/snapshot.d.ts +0 -30
- package/dist/core/snapshot.js +0 -212
- package/dist/core/snapshot.js.map +0 -1
- package/dist/core/tasks.d.ts +0 -13
- package/dist/core/tasks.js +0 -180
- package/dist/core/tasks.js.map +0 -1
- package/dist/core/types.d.ts +0 -98
- package/dist/core/types.js +0 -2
- package/dist/core/types.js.map +0 -1
- package/dist/core/verify.d.ts +0 -8
- package/dist/core/verify.js +0 -66
- package/dist/core/verify.js.map +0 -1
- package/dist/index.d.ts +0 -15
- package/dist/index.js +0 -16
- package/dist/index.js.map +0 -1
- package/dist/templates/assets.d.ts +0 -11
- package/dist/templates/assets.js +0 -179
- package/dist/templates/assets.js.map +0 -1
- package/dist/version.d.ts +0 -1
- package/dist/version.js +0 -2
- package/dist/version.js.map +0 -1
package/ARCHITECTURE.md
CHANGED
|
@@ -1,34 +1,32 @@
|
|
|
1
1
|
# Architecture
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Keel is a single pure-Rust executable (`keel`) that serves both the CLI and the stdio MCP server from one codebase.
|
|
4
4
|
|
|
5
5
|
## Design choices
|
|
6
6
|
|
|
7
|
-
Keel assumes
|
|
7
|
+
Keel assumes your coding tool (Claude Code, Codex, Cursor, OpenCode, Antigravity) already handles planning, code search, and sub-agent scheduling well. Keel stays strictly in the repository contract, local memory, and verification layer:
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
-
|
|
12
|
-
-
|
|
13
|
-
-
|
|
14
|
-
- Built-in LLM API dependencies inside the CLI.
|
|
15
|
-
- Requiring a task folder for small edits.
|
|
16
|
-
|
|
17
|
-
Everything Keel does lives in plain files under `.keel/`, a short managed block in `AGENTS.md`, five skill files in `.agents/skills/`, and stateless read/write commands.
|
|
9
|
+
- No custom sub-agent definitions or dispatch rules.
|
|
10
|
+
- No vendor `PreToolUse` / `UserPromptSubmit` hooks.
|
|
11
|
+
- No Python or Node.js runtime required to run `keel` (the npm package `@pdxxxx/keel` is a zero-dependency launcher that downloads the SHA-256 verified Rust binary from GitHub Releases).
|
|
12
|
+
- No built-in LLM API calls.
|
|
13
|
+
- No task directory required for small edits.
|
|
18
14
|
|
|
19
15
|
## Code layout
|
|
20
16
|
|
|
21
|
-
- `
|
|
22
|
-
- `
|
|
23
|
-
- `
|
|
24
|
-
- `
|
|
17
|
+
- `Cargo.toml`, `src/` — single Rust crate producing `keel`:
|
|
18
|
+
- `main.rs` / `cli.rs` — CLI parser (`-C/--root`, `--json`, clean single-line `stderr` diagnostics)
|
|
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
|
+
- `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`
|
|
22
|
+
- `tests/` — real child-process CLI (`tests/cli.rs`) and stdio MCP (`tests/stdio.rs`) integration suites.
|
|
23
|
+
- `npm/` — zero-dependency npm wrapper (`npm/install.js`, `npm/bin/keel.js`, `npm/test.mjs`).
|
|
24
|
+
- `docs/` — standalone VitePress documentation site deployed to GitHub Pages.
|
|
25
25
|
|
|
26
26
|
## On-disk formats
|
|
27
27
|
|
|
28
28
|
### Rules (`.keel/rules/**/*.md`)
|
|
29
29
|
|
|
30
|
-
Rule files use YAML frontmatter followed by Markdown:
|
|
31
|
-
|
|
32
30
|
```markdown
|
|
33
31
|
---
|
|
34
32
|
id: auth-token-rotation
|
|
@@ -38,25 +36,20 @@ paths:
|
|
|
38
36
|
- src/auth/**
|
|
39
37
|
---
|
|
40
38
|
|
|
41
|
-
|
|
39
|
+
Explain why this invariant exists.
|
|
42
40
|
```
|
|
43
41
|
|
|
44
|
-
- `severity
|
|
45
|
-
- `paths
|
|
46
|
-
- Frontmatter
|
|
47
|
-
-
|
|
48
|
-
|
|
49
|
-
`keel rules match` returns only the metadata index (`id`, `file`, `summary`, `severity`, `paths`, `global`) so an agent can open only the files that actually apply. `keel rules check --stale` additionally flags path globs matching zero repo files, rules longer than 80 lines, and repositories with more than 5 global rules (`--strict` fails on warnings).
|
|
42
|
+
- `severity`: `invariant`, `guideline`, or `adr` (defaults to `guideline`).
|
|
43
|
+
- `paths`: POSIX globs (`*`, `**`, `**/`, `?`). Empty or omitted means global.
|
|
44
|
+
- Frontmatter starts with `---` on line 1 and closes only on a standalone `---` line (LF, CRLF, or EOF).
|
|
45
|
+
- `keel rules check --stale` warns on dead path globs, rules over 80 lines, and more than 5 global rules (`--strict` fails on warnings).
|
|
50
46
|
|
|
51
47
|
### Tasks (`.keel/tasks/<YYYY-MM-DD>-<slug>/`)
|
|
52
48
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
- `
|
|
56
|
-
-
|
|
57
|
-
- `research/`: optional directory for notes that should survive chat compaction.
|
|
58
|
-
|
|
59
|
-
`keel task archive <id>` sets status to `done` and moves the folder into `.keel/tasks/archive/<id>/`. Both TS and Rust implementations reject task IDs containing `..` or absolute paths.
|
|
49
|
+
- `meta.json`: `id`, `title`, `status` (`open` | `done`), `createdAt`, `updatedAt`.
|
|
50
|
+
- `spec.md`: single living document for goals, non-goals, acceptance criteria, and decisions.
|
|
51
|
+
- `research/`: optional persisted notes.
|
|
52
|
+
- Archived tasks live under `.keel/tasks/archive/<id>/`. Task IDs with `..` or absolute paths are rejected.
|
|
60
53
|
|
|
61
54
|
### Verification gates (`.keel/config.yaml`)
|
|
62
55
|
|
|
@@ -68,34 +61,46 @@ verify:
|
|
|
68
61
|
command: pnpm --filter api test
|
|
69
62
|
paths:
|
|
70
63
|
- packages/api/**
|
|
71
|
-
|
|
72
|
-
|
|
64
|
+
timeoutMs: 120000
|
|
65
|
+
maxOutputChars: 16000
|
|
73
66
|
memory:
|
|
74
67
|
sources: []
|
|
75
68
|
```
|
|
76
69
|
|
|
77
|
-
|
|
70
|
+
- `timeoutMs` defaults to `120000` (`0` disables timeout). Timed-out gates terminate their process tree and report `exitCode: 124` with `timedOut: true`.
|
|
71
|
+
- `maxOutputChars` defaults to `16000` (`0` disables truncation). Oversized logs keep the tail (preserving error summaries) with a truncation header.
|
|
72
|
+
- Invalid or unknown keys in `.keel/config.yaml` are caught by `keel doctor` and fail closed before gates run.
|
|
78
73
|
|
|
79
|
-
###
|
|
74
|
+
### Memory (`src/mem.rs`)
|
|
80
75
|
|
|
81
|
-
|
|
76
|
+
Streaming, read-only scan across seven sources:
|
|
82
77
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
Read-only scan across:
|
|
86
|
-
|
|
87
|
-
- `keel`: `.keel/tasks/` and `.keel/rules/` Markdown files.
|
|
78
|
+
- `keel`: `.keel/tasks/` and `.keel/rules/` Markdown files
|
|
88
79
|
- `claude`: `~/.claude/projects/**/*.jsonl`
|
|
89
80
|
- `codex`: `~/.codex/sessions/**/*.jsonl`
|
|
90
81
|
- `opencode`: `~/.local/share/opencode/**/*.jsonl`
|
|
91
|
-
- `
|
|
82
|
+
- `antigravity`: `~/.gemini/antigravity/brain/*/.system_generated/logs/transcript.jsonl`
|
|
83
|
+
- `gemini`: `~/.gemini/tmp/*/chats/*.json`
|
|
84
|
+
- `custom`: directories in `.keel/config.yaml` (`memory.sources`) and `KEEL_MEM_DIRS`
|
|
85
|
+
|
|
86
|
+
Supports `--scope project | all`: `project` restricts results to sessions matching the active repository path; `all` searches everything while boosting current-project matches.
|
|
87
|
+
|
|
88
|
+
### External SHA-256 snapshots (`src/snapshot.rs`)
|
|
89
|
+
|
|
90
|
+
`keel ablate` (`~/.keel-ablate/<repo-hash>/`) and `keel migrate cleanup` (`~/.keel-migrate/<repo-hash>/`) share one transaction-safe snapshot engine:
|
|
92
91
|
|
|
93
|
-
|
|
92
|
+
1. Rejects symlinks anywhere along workspace or backup paths.
|
|
93
|
+
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.
|
|
95
|
+
4. Verifies every path against post-operation hashes before restoring (refusing conflicts unless `--force` is passed).
|
|
94
96
|
|
|
95
|
-
###
|
|
97
|
+
### Multi-repo MCP root resolution (`src/mcp_root.rs`)
|
|
96
98
|
|
|
97
|
-
|
|
99
|
+
Per-call precedence (highest to lowest):
|
|
98
100
|
|
|
99
|
-
|
|
101
|
+
1. `arguments.root` (accepted on all 13 tools; resolves upward `.keel/` -> `.git/` -> given dir)
|
|
102
|
+
2. Startup `--root <path>`
|
|
103
|
+
3. `initialize` `params.rootUri` or `params.workspaceFolders[0].uri` (when `--root` was omitted)
|
|
104
|
+
4. Process `cwd` upward discovery
|
|
100
105
|
|
|
101
|
-
|
|
106
|
+
When no explicit root is provided and `cwd` has neither `.keel/` nor `.git/`, mutating and verification tools (`keel_task_create`, `keel_task_update`, `keel_rules_add`, `keel_verify`) refuse to run instead of writing into a homeless aggregator directory. Pass `--root <dir> --lock-root` to restrict all calls within one canonical directory tree.
|
package/CHANGELOG.md
CHANGED
|
@@ -1,22 +1,33 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
-
##
|
|
3
|
+
## 2.0.1 - 2026-11-24
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
- Embedded `assets/keel.ico` (16–256px) and Windows PE version metadata into `keel.exe` via `build.rs` and `winresource`.
|
|
6
|
+
- Added copy-ready coding agent prompts for new-repo initialization, v2.x upgrades, and Trellis migration to the bilingual docs site.
|
|
7
|
+
- Made release tag validation and MCP `serverInfo.version` tests version-agnostic across patch releases.
|
|
6
8
|
|
|
7
|
-
|
|
8
|
-
- **Rule staleness & hygiene checks**: added `keel rules check --stale` / `--strict` (and `stale: true` on MCP `keel_rules_check`) to flag dead path globs, rules over 80 lines, and excess global rules while preserving the 1.0.0 default output.
|
|
9
|
-
- **Git bugfix hotspots**: added `keel hotspots` to rank existing files by recent churn and bugfix commits.
|
|
10
|
-
- **One-shot migration tools**: added `keel migrate scan / plan / cleanup / rollback` backed by shared external SHA-256 snapshots, plus the `keel-migrate` standard skill installed by `keel init`.
|
|
9
|
+
## 2.0.0 - 2026-11-24
|
|
11
10
|
|
|
12
|
-
|
|
11
|
+
Pure Rust single-binary release (`keel`).
|
|
12
|
+
|
|
13
|
+
### Architecture & Packaging
|
|
14
|
+
- Consolidated the entire CLI and MCP server into a single pure-Rust binary (`keel`, ~3.6 MiB); removed the duplicate TypeScript core, standalone `keel-mcp` crate, and cross-runtime parity harness.
|
|
15
|
+
- Replaced `@pdxxxx/keel` on npm with a zero-dependency thin launcher (~10 KB packed) that downloads and SHA-256 verifies the matching GitHub Release binary on install.
|
|
16
|
+
- Updated CI and Release workflows for five native binary targets (`linux-x86_64`, `linux-aarch64`, `macos-arm64`, `macos-x86_64`, `windows-x86_64.exe`), uploading GitHub Release assets and `SHA256SUMS.txt` before publishing to npm via OIDC Trusted Publishing.
|
|
17
|
+
|
|
18
|
+
### New Commands & Reliability Fixes
|
|
19
|
+
- **`keel update`**: safely refreshes managed templates (`AGENTS.md` block, `.keel/rules/index.md`, `.agents/skills/keel-*`) without touching `.keel/config.yaml`, user rules, or tasks. `keel init --force` no longer overwrites user `config.yaml` unless `--reset-config` is passed.
|
|
20
|
+
- **`keel doctor`**: validates `.keel/config.yaml` strictly (catching typos, bad types, duplicate gate names), `AGENTS.md` marker integrity, `git` availability, and stale rules.
|
|
21
|
+
- **Global `-C, --root <PATH>` & `--json`**: supported consistently across CLI commands with clean single-line `stderr` error reporting.
|
|
22
|
+
- **Multi-repo MCP & 13 tools**: all 13 MCP tools (`keel_rules_*`, `keel_task_*`, `keel_verify`, `keel_hotspots`, `keel_mem_*`) accept highest-priority per-call `root`, support `initialize` `rootUri`/`workspaceFolders`, enforce homeless-directory write protection, and support `--lock-root`.
|
|
23
|
+
- **Verification safety**: added `timeoutMs` (default 120s, process-tree termination) and `maxOutputChars` (default 16,000, tail-preserving truncation) to `verify.gates`.
|
|
24
|
+
- **Memory & Git improvements**: added `--scope project | all` filtering and current-project score boosting, read-only `antigravity` and `gemini` transcript adapters, `keel_mem_show`, and nested monorepo git-path alignment.
|
|
25
|
+
- **Migration coverage**: expanded `keel migrate` to detect and safely clean Trellis leftovers in `.agents/skills/trellis-*`, `.codex/`, `.cursor/hooks*`, `.gemini/settings.json`, and `CLAUDE.md`.
|
|
13
26
|
|
|
14
|
-
|
|
27
|
+
## 1.1.0 - 2026-11-24
|
|
28
|
+
|
|
29
|
+
- Added incremental `verify.gates[].paths` + `keel verify --git / --staged / --base`, `keel rules check --stale / --strict`, `keel hotspots`, and `keel migrate scan / plan / cleanup / rollback`.
|
|
30
|
+
|
|
31
|
+
## 1.0.0 - 2026-11-24
|
|
15
32
|
|
|
16
|
-
- `
|
|
17
|
-
- `keel rules`: `list`, `match` (path globs plus `--git`, `--staged`, `--base`), `add`, and `check`.
|
|
18
|
-
- `keel task`: `create`, `list`, `show`, `done`, `reopen`, and `archive`.
|
|
19
|
-
- `keel verify`: runs configured commands from `.keel/config.yaml` with `--gate`, `--fail-fast`, and `--json`.
|
|
20
|
-
- `keel mem`: `sources`, `sessions`, `search`, and `show` across `.keel/` files and local Claude Code, Codex, OpenCode, and custom JSONL transcripts.
|
|
21
|
-
- `keel ablate` / `keel restore`: SHA-256 verified temporary removal and restoration of Keel files with conflict checks.
|
|
22
|
-
- `keel mcp` & `crates/keel-mcp`: stdio MCP server in both Node.js and Rust, verified against each other with `crates/keel-mcp/tests/parity.mjs`.
|
|
33
|
+
- Initial release (`init`, `rules`, `task`, `verify`, `mem`, `ablate` / `restore`, `mcp`).
|
package/LICENSE
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2026 pdxxxx
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 pdxxxx
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -10,14 +10,13 @@
|
|
|
10
10
|
<a href="https://www.npmjs.com/package/@pdxxxx/keel"><img src="https://img.shields.io/npm/v/%40pdxxxx%2Fkeel?style=flat-square&color=cb3837" alt="npm version" /></a>
|
|
11
11
|
<a href="https://github.com/pdxxxx/keel/actions/workflows/ci.yml"><img src="https://img.shields.io/github/actions/workflow/status/pdxxxx/keel/ci.yml?style=flat-square&label=CI" alt="CI" /></a>
|
|
12
12
|
<a href="./LICENSE"><img src="https://img.shields.io/badge/license-MIT-2563eb?style=flat-square" alt="MIT License" /></a>
|
|
13
|
-
<img src="https://img.shields.io/badge/node-%3E%3D20-339933?style=flat-square&logo=node.js&logoColor=white" alt="Node >= 20" />
|
|
14
13
|
<img src="https://img.shields.io/badge/rust-1.85%2B-dea584?style=flat-square&logo=rust&logoColor=black" alt="Rust 1.85+" />
|
|
15
14
|
</p>
|
|
16
15
|
|
|
17
16
|
<p>
|
|
17
|
+
<a href="https://pdxxxx.github.io/keel/">Docs</a> ·
|
|
18
18
|
<a href="./README_CN.md">简体中文</a> ·
|
|
19
19
|
<a href="./ARCHITECTURE.md">Architecture</a> ·
|
|
20
|
-
<a href="./crates/keel-mcp/README.md">Rust MCP</a> ·
|
|
21
20
|
<a href="./CHANGELOG.md">Changelog</a>
|
|
22
21
|
</p>
|
|
23
22
|
|
|
@@ -25,18 +24,27 @@
|
|
|
25
24
|
|
|
26
25
|
---
|
|
27
26
|
|
|
28
|
-
Keel stores project
|
|
27
|
+
Keel is a single Rust binary (~3.6 MiB) that stores project rules, optional task specs, and check commands under `.keel/`, searches local session logs across seven tools, and exposes 13 tools over stdio MCP.
|
|
29
28
|
|
|
30
|
-
It does not manage sub-agents, install editor hooks, or
|
|
29
|
+
It does not manage sub-agents, install editor hooks, or tie you to a specific coding tool.
|
|
31
30
|
|
|
32
|
-
##
|
|
33
|
-
|
|
34
|
-
Requires **Node.js >= 20**.
|
|
31
|
+
## Install
|
|
35
32
|
|
|
36
33
|
```sh
|
|
34
|
+
# Recommended: installs the prebuilt native binary verified with SHA-256
|
|
37
35
|
npm install -g @pdxxxx/keel@latest
|
|
38
36
|
```
|
|
39
37
|
|
|
38
|
+
Or build directly from source with Rust 1.85+:
|
|
39
|
+
|
|
40
|
+
```sh
|
|
41
|
+
cargo install --git https://github.com/pdxxxx/keel --locked
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
Prebuilt binaries for Linux (`x86_64`, `aarch64`), macOS (`arm64`, `x86_64`), and Windows (`x86_64`) are also attached to [GitHub Releases](https://github.com/pdxxxx/keel/releases).
|
|
45
|
+
|
|
46
|
+
## Quick Start
|
|
47
|
+
|
|
40
48
|
```sh
|
|
41
49
|
# 1. Initialize .keel/, AGENTS.md block, and standard .agents/skills/
|
|
42
50
|
keel init
|
|
@@ -50,89 +58,80 @@ keel rules add auth-rotation \
|
|
|
50
58
|
keel rules match --git
|
|
51
59
|
|
|
52
60
|
# 4. Search past sessions and .keel/ docs
|
|
53
|
-
keel mem search "refresh token"
|
|
61
|
+
keel mem search "refresh token" --scope project
|
|
54
62
|
|
|
55
|
-
# 5. Run checks matching your current git diff (
|
|
63
|
+
# 5. Run checks matching your current git diff (drop --git for all gates)
|
|
56
64
|
keel verify --git
|
|
57
65
|
```
|
|
58
66
|
|
|
59
67
|
## Existing Repos & Migration
|
|
60
68
|
|
|
61
|
-
On a mature codebase, start with checks and git history rather than writing broad style docs:
|
|
62
|
-
|
|
63
69
|
```sh
|
|
64
|
-
keel hotspots
|
|
65
|
-
keel
|
|
66
|
-
keel
|
|
67
|
-
keel migrate
|
|
68
|
-
keel migrate cleanup --dry-run
|
|
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
|
|
73
|
+
keel migrate scan # inventory Trellis, .cursorrules, CLAUDE.md, etc.
|
|
74
|
+
keel migrate cleanup --dry-run # preview safe removal (backed up; undo with `keel migrate rollback`)
|
|
69
75
|
```
|
|
70
76
|
|
|
71
|
-
Pair `keel migrate` with the bundled `keel-migrate` skill to distill only non-obvious traps into `.keel/rules/`.
|
|
72
|
-
|
|
73
77
|
## Commands
|
|
74
78
|
|
|
75
|
-
|
|
79
|
+
Global flags: `-C, --root <PATH>` and `--json`.
|
|
76
80
|
|
|
77
81
|
| Command | Description |
|
|
78
82
|
| --- | --- |
|
|
79
|
-
| `keel init` | Creates `.keel/`, detects project scripts
|
|
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. |
|
|
80
86
|
| `keel rules` | `list`, `match [paths...] [--git \| --staged \| --base <ref>]`, `add <id>`, `check [--stale \| --strict]`. |
|
|
81
87
|
| `keel task` | `create`, `list`, `show`, `done`, `reopen`, `archive` — optional single-file `spec.md` per task. |
|
|
82
|
-
| `keel verify` | Runs gates in `.keel/config.yaml` (`--gate`, `--git`, `--staged`, `--base <ref>`, `--fail-fast`). |
|
|
88
|
+
| `keel verify` | Runs gates in `.keel/config.yaml` (`--gate`, `--git`, `--staged`, `--base <ref>`, `--fail-fast`) with timeout and output-cap protection. |
|
|
83
89
|
| `keel hotspots` | Ranks existing files by recent churn and bugfix commits (`--commits`, `--limit`). |
|
|
84
|
-
| `keel mem` | `sources`, `sessions`, `search
|
|
85
|
-
| `keel migrate` | `scan`, `plan`, `cleanup [--dry-run]`, `rollback`
|
|
86
|
-
| `keel ablate` / `restore` | Temporarily removes Keel
|
|
87
|
-
| `keel mcp` | Starts the
|
|
90
|
+
| `keel mem` | `sources`, `sessions`, `search`, `show` (`--scope project \| all`) across `.keel/`, Claude Code, Codex, OpenCode, Antigravity, Gemini, and custom dirs. |
|
|
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. |
|
|
93
|
+
| `keel mcp` | Starts the stdio MCP server (13 tools, multi-repo per-call `root`, optional `--lock-root`). |
|
|
88
94
|
|
|
89
95
|
## MCP Server
|
|
90
96
|
|
|
91
|
-
|
|
97
|
+
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.
|
|
92
98
|
|
|
93
|
-
**
|
|
99
|
+
**Codex CLI (global)**
|
|
94
100
|
|
|
95
|
-
```
|
|
96
|
-
|
|
97
|
-
"mcpServers": {
|
|
98
|
-
"keel": {
|
|
99
|
-
"command": "keel",
|
|
100
|
-
"args": ["mcp"]
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
}
|
|
101
|
+
```sh
|
|
102
|
+
codex mcp add keel -- keel mcp
|
|
104
103
|
```
|
|
105
104
|
|
|
106
|
-
**
|
|
105
|
+
**Standard `mcpServers` JSON** (Claude Code, Cursor, OpenCode, Antigravity)
|
|
107
106
|
|
|
108
107
|
```json
|
|
109
108
|
{
|
|
110
109
|
"mcpServers": {
|
|
111
110
|
"keel": {
|
|
112
|
-
"command": "
|
|
113
|
-
"args": ["
|
|
111
|
+
"command": "keel",
|
|
112
|
+
"args": ["mcp"]
|
|
114
113
|
}
|
|
115
114
|
}
|
|
116
115
|
}
|
|
117
116
|
```
|
|
118
117
|
|
|
118
|
+
Pass `--root <path> --lock-root` if you want to pin an instance to a single repository.
|
|
119
|
+
|
|
119
120
|
<details>
|
|
120
|
-
<summary>Exposed MCP tools (
|
|
121
|
+
<summary>Exposed MCP tools (13)</summary>
|
|
121
122
|
|
|
122
|
-
- `keel_rules_list` · `keel_rules_match` · `
|
|
123
|
-
- `keel_task_list` · `keel_task_create` · `keel_task_show`
|
|
124
|
-
- `keel_verify`
|
|
125
|
-
- `keel_mem_search` · `keel_mem_sessions`
|
|
123
|
+
- `keel_rules_list` · `keel_rules_match` · `keel_rules_add` · `keel_rules_check`
|
|
124
|
+
- `keel_task_list` · `keel_task_create` · `keel_task_show` · `keel_task_update`
|
|
125
|
+
- `keel_verify` · `keel_hotspots`
|
|
126
|
+
- `keel_mem_search` · `keel_mem_sessions` · `keel_mem_show`
|
|
126
127
|
|
|
127
128
|
</details>
|
|
128
129
|
|
|
129
|
-
See [crates/keel-mcp/README.md](./crates/keel-mcp/README.md) for Windows examples and parity checks.
|
|
130
|
-
|
|
131
130
|
## Repository Layout
|
|
132
131
|
|
|
133
132
|
```text
|
|
134
133
|
.keel/
|
|
135
|
-
config.yaml # verify gates (
|
|
134
|
+
config.yaml # verify gates (paths, timeoutMs, maxOutputChars) & memory sources
|
|
136
135
|
rules/ # path-scoped markdown rules (YAML frontmatter)
|
|
137
136
|
tasks/ # optional task specs (meta.json + spec.md)
|
|
138
137
|
AGENTS.md # managed block (<!-- KEEL:START --> ... <!-- KEEL:END -->)
|
package/README_CN.md
CHANGED
|
@@ -10,14 +10,13 @@
|
|
|
10
10
|
<a href="https://www.npmjs.com/package/@pdxxxx/keel"><img src="https://img.shields.io/npm/v/%40pdxxxx%2Fkeel?style=flat-square&color=cb3837" alt="npm version" /></a>
|
|
11
11
|
<a href="https://github.com/pdxxxx/keel/actions/workflows/ci.yml"><img src="https://img.shields.io/github/actions/workflow/status/pdxxxx/keel/ci.yml?style=flat-square&label=CI" alt="CI" /></a>
|
|
12
12
|
<a href="./LICENSE"><img src="https://img.shields.io/badge/license-MIT-2563eb?style=flat-square" alt="MIT License" /></a>
|
|
13
|
-
<img src="https://img.shields.io/badge/node-%3E%3D20-339933?style=flat-square&logo=node.js&logoColor=white" alt="Node >= 20" />
|
|
14
13
|
<img src="https://img.shields.io/badge/rust-1.85%2B-dea584?style=flat-square&logo=rust&logoColor=black" alt="Rust 1.85+" />
|
|
15
14
|
</p>
|
|
16
15
|
|
|
17
16
|
<p>
|
|
17
|
+
<a href="https://pdxxxx.github.io/keel/zh/">官网文档</a> ·
|
|
18
18
|
<a href="./README.md">English</a> ·
|
|
19
19
|
<a href="./ARCHITECTURE.md">Architecture</a> ·
|
|
20
|
-
<a href="./crates/keel-mcp/README.md">Rust MCP</a> ·
|
|
21
20
|
<a href="./CHANGELOG.md">Changelog</a>
|
|
22
21
|
</p>
|
|
23
22
|
|
|
@@ -25,18 +24,27 @@
|
|
|
25
24
|
|
|
26
25
|
---
|
|
27
26
|
|
|
28
|
-
Keel
|
|
27
|
+
Keel 是一个单文件纯 Rust 可执行程序(约 3.6 MiB),把项目规则、可选任务文档和校验命令以纯文本存在 `.keel/` 下,跨 7 类本地数据源检索历史会话,并通过 stdio MCP 暴露 13 个工具。
|
|
29
28
|
|
|
30
|
-
它不接管子 Agent 调度,不往编辑器里装私有 Hook,也不绑定特定 AI
|
|
29
|
+
它不接管子 Agent 调度,不往编辑器里装私有 Hook,也不绑定特定 AI 工具。
|
|
31
30
|
|
|
32
|
-
##
|
|
33
|
-
|
|
34
|
-
需要 **Node.js >= 20**。
|
|
31
|
+
## 安装
|
|
35
32
|
|
|
36
33
|
```sh
|
|
34
|
+
# 推荐:自动下载对应平台预编译二进制并校验 SHA-256
|
|
37
35
|
npm install -g @pdxxxx/keel@latest
|
|
38
36
|
```
|
|
39
37
|
|
|
38
|
+
或使用 Rust 1.85+ 从源码直接安装:
|
|
39
|
+
|
|
40
|
+
```sh
|
|
41
|
+
cargo install --git https://github.com/pdxxxx/keel --locked
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
Linux(`x86_64`、`aarch64`)、macOS(`arm64`、`x86_64`)与 Windows(`x86_64`)预编译单文件也可从 [GitHub Releases](https://github.com/pdxxxx/keel/releases) 直接下载。
|
|
45
|
+
|
|
46
|
+
## 快速开始
|
|
47
|
+
|
|
40
48
|
```sh
|
|
41
49
|
# 1. 初始化 .keel/、AGENTS.md 托管块与标准 .agents/skills/
|
|
42
50
|
keel init
|
|
@@ -46,93 +54,84 @@ keel rules add auth-rotation \
|
|
|
46
54
|
--summary "Rotate refresh tokens atomically" \
|
|
47
55
|
--paths "src/auth/**"
|
|
48
56
|
|
|
49
|
-
# 3.
|
|
57
|
+
# 3. 查找命中当前 git diff 的规则
|
|
50
58
|
keel rules match --git
|
|
51
59
|
|
|
52
|
-
# 4.
|
|
53
|
-
keel mem search "refresh token"
|
|
60
|
+
# 4. 检索当前项目相关的历史会话和 .keel/ 文档
|
|
61
|
+
keel mem search "refresh token" --scope project
|
|
54
62
|
|
|
55
63
|
# 5. 只运行命中当前变更的检查门禁(去掉 --git 跑全量)
|
|
56
64
|
keel verify --git
|
|
57
65
|
```
|
|
58
66
|
|
|
59
|
-
##
|
|
60
|
-
|
|
61
|
-
在已有代码库里,先从门禁和 Git 历史热点入手,不用一上来写大篇幅规范:
|
|
67
|
+
## 老仓库接入、升级与迁移
|
|
62
68
|
|
|
63
69
|
```sh
|
|
64
|
-
keel hotspots
|
|
65
|
-
keel
|
|
66
|
-
keel
|
|
67
|
-
keel migrate
|
|
68
|
-
keel migrate cleanup --dry-run
|
|
70
|
+
keel hotspots # 找出高频修复文件,优先给暗坑补规则
|
|
71
|
+
keel doctor # 检查 config.yaml 字段错误、AGENTS.md 标记、git 与失效规则
|
|
72
|
+
keel update # 安全刷新 AGENTS.md 块与内置 skills,不动你的 config.yaml
|
|
73
|
+
keel migrate scan # 盘点 Trellis、.cursorrules、CLAUDE.md 等旧配置
|
|
74
|
+
keel migrate cleanup --dry-run # 预览安全清理(自动备份,可 `keel migrate rollback` 回滚)
|
|
69
75
|
```
|
|
70
76
|
|
|
71
|
-
配合内置的 `keel-migrate` skill,可让 AI 将旧框架规范按 10:1 提纯进 `.keel/rules/`。
|
|
72
|
-
|
|
73
77
|
## 命令一览
|
|
74
78
|
|
|
75
|
-
|
|
79
|
+
全局选项:`-C, --root <PATH>` 与 `--json`。
|
|
76
80
|
|
|
77
81
|
| 命令 | 说明 |
|
|
78
82
|
| --- | --- |
|
|
79
|
-
| `keel init` | 创建 `.keel
|
|
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` 及过期规则。 |
|
|
80
86
|
| `keel rules` | `list`、`match [paths...] [--git \| --staged \| --base <ref>]`、`add <id>`、`check [--stale \| --strict]`。 |
|
|
81
87
|
| `keel task` | `create`、`list`、`show`、`done`、`reopen`、`archive`,按需用单个 `spec.md` 记录复杂任务。 |
|
|
82
|
-
| `keel verify` | 运行 `.keel/config.yaml`
|
|
83
|
-
| `keel hotspots` | 按近期改动与 bugfix
|
|
84
|
-
| `keel mem` | `sources`、`sessions`、`search
|
|
85
|
-
| `keel migrate` | `scan`、`plan`、`cleanup [--dry-run]`、`rollback
|
|
86
|
-
| `keel ablate` / `restore` |
|
|
87
|
-
| `keel mcp` |
|
|
88
|
+
| `keel verify` | 运行 `.keel/config.yaml` 中的门禁(支持 `--gate`、`--git`、`--staged`、`--base <ref>`、`--fail-fast`),自带超时强杀与输出截断。 |
|
|
89
|
+
| `keel hotspots` | 按近期改动与 bugfix 频率列出高风险现存文件(`--commits`、`--limit`)。 |
|
|
90
|
+
| `keel mem` | `sources`、`sessions`、`search`、`show`(支持 `--scope project \| all`),跨 `.keel/`、Claude Code、Codex、OpenCode、Antigravity、Gemini 与自定义目录流式检索。 |
|
|
91
|
+
| `keel migrate` | `scan`、`plan`、`cleanup [--dry-run]`、`rollback`,由外部 SHA-256 快照保护。 |
|
|
92
|
+
| `keel ablate` / `restore` | 临时移出 Keel 文件做 A/B 对比,随后逐字节无损恢复。 |
|
|
93
|
+
| `keel mcp` | 启动 stdio MCP 服务(13 个工具,支持按次 `root` 切换多仓库与 `--lock-root`)。 |
|
|
88
94
|
|
|
89
95
|
## MCP 接入
|
|
90
96
|
|
|
91
|
-
|
|
97
|
+
单个常驻 `keel mcp` 进程即可安全服务多个仓库(完美适配 MCP 聚合服务)。全部 13 个工具均支持最高优先级可选参数 `root`。
|
|
92
98
|
|
|
93
|
-
**
|
|
99
|
+
**Codex CLI 全局安装**
|
|
94
100
|
|
|
95
|
-
```
|
|
96
|
-
|
|
97
|
-
"mcpServers": {
|
|
98
|
-
"keel": {
|
|
99
|
-
"command": "keel",
|
|
100
|
-
"args": ["mcp"]
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
}
|
|
101
|
+
```sh
|
|
102
|
+
codex mcp add keel -- keel mcp
|
|
104
103
|
```
|
|
105
104
|
|
|
106
|
-
|
|
105
|
+
**通用 `mcpServers` JSON**(Claude Code / Cursor / OpenCode / Antigravity)
|
|
107
106
|
|
|
108
107
|
```json
|
|
109
108
|
{
|
|
110
109
|
"mcpServers": {
|
|
111
110
|
"keel": {
|
|
112
|
-
"command": "
|
|
113
|
-
"args": ["
|
|
111
|
+
"command": "keel",
|
|
112
|
+
"args": ["mcp"]
|
|
114
113
|
}
|
|
115
114
|
}
|
|
116
115
|
}
|
|
117
116
|
```
|
|
118
117
|
|
|
118
|
+
如需强制锁死在单个仓库目录,传入 `--root <path> --lock-root`。
|
|
119
|
+
|
|
119
120
|
<details>
|
|
120
|
-
<summary>暴露的 MCP 工具(
|
|
121
|
+
<summary>暴露的 MCP 工具(13 个)</summary>
|
|
121
122
|
|
|
122
|
-
- `keel_rules_list` · `keel_rules_match` · `
|
|
123
|
-
- `keel_task_list` · `keel_task_create` · `keel_task_show`
|
|
124
|
-
- `keel_verify
|
|
125
|
-
- `keel_mem_search` · `keel_mem_sessions`
|
|
123
|
+
- `keel_rules_list` · `keel_rules_match` · `keel_rules_add` · `keel_rules_check`
|
|
124
|
+
- `keel_task_list` · `keel_task_create` · `keel_task_show` · `keel_task_update`
|
|
125
|
+
- `keel_verify` · `keel_hotspots`
|
|
126
|
+
- `keel_mem_search` · `keel_mem_sessions` · `keel_mem_show`
|
|
126
127
|
|
|
127
128
|
</details>
|
|
128
129
|
|
|
129
|
-
Windows 配置示例与双端对照测试见 [crates/keel-mcp/README.md](./crates/keel-mcp/README.md)。
|
|
130
|
-
|
|
131
130
|
## 仓库目录结构
|
|
132
131
|
|
|
133
132
|
```text
|
|
134
133
|
.keel/
|
|
135
|
-
config.yaml #
|
|
134
|
+
config.yaml # 校验门禁(支持 paths、timeoutMs、maxOutputChars)与额外记忆目录
|
|
136
135
|
rules/ # 带 YAML frontmatter 的按路径规则
|
|
137
136
|
tasks/ # 可选任务目录(meta.json + spec.md)
|
|
138
137
|
AGENTS.md # 托管块(<!-- KEEL:START --> ... <!-- KEEL:END -->)
|
package/npm/bin/keel.js
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { spawn } from 'node:child_process';
|
|
3
|
+
import { constants } from 'node:os';
|
|
4
|
+
import { fileURLToPath } from 'node:url';
|
|
5
|
+
|
|
6
|
+
const native = process.platform === 'win32' ? 'keel.exe' : 'keel';
|
|
7
|
+
const binary = process.env.KEEL_BINARY || fileURLToPath(new URL(`../native/${native}`, import.meta.url));
|
|
8
|
+
const child = spawn(binary, process.argv.slice(2), { stdio: 'inherit' });
|
|
9
|
+
const handlers = new Map();
|
|
10
|
+
for (const signal of ['SIGINT', 'SIGTERM', 'SIGHUP']) {
|
|
11
|
+
const forward = () => child.kill(signal);
|
|
12
|
+
handlers.set(signal, forward);
|
|
13
|
+
process.on(signal, forward);
|
|
14
|
+
}
|
|
15
|
+
child.once('error', error => {
|
|
16
|
+
console.error(`keel: Cannot start ${binary}: ${error.message}. Run npm rebuild @pdxxxx/keel to download again, or cargo install --git https://github.com/pdxxxx/keel.`);
|
|
17
|
+
process.exitCode = 1;
|
|
18
|
+
});
|
|
19
|
+
child.once('close', (code, signal) => {
|
|
20
|
+
for (const [name, handler] of handlers) process.off(name, handler);
|
|
21
|
+
if (signal) {
|
|
22
|
+
process.exitCode = 128 + (constants.signals[signal] || 0);
|
|
23
|
+
if (process.platform !== 'win32') process.kill(process.pid, signal);
|
|
24
|
+
} else if (!process.exitCode) process.exitCode = code ?? 1;
|
|
25
|
+
});
|