-
Notifications
You must be signed in to change notification settings - Fork 544
feat(kimi): modernize Kimi adapter for Kimi Code CLI v0.18.0+ #939
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
1b23e1e
5b907e0
cd87e58
ea90545
421a0cd
2236751
8833183
dc5f3df
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| <!-- Gentle AI managed agent instructions for Kimi Code CLI. --> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,101 @@ | ||
| ## Engram Persistent Memory — Protocol | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Resolve markdown heading-structure lint warnings. Line 1 starts with a level-2 heading, and Lines 74/77/80/83/86/89 are missing the required surrounding blank lines per markdownlint hints. Also applies to: 74-90 🧰 Tools🪛 markdownlint-cli2 (0.22.1)[warning] 1-1: First line in a file should be a top-level heading (MD041, first-line-heading, first-line-h1) 🤖 Prompt for AI AgentsSource: Linters/SAST tools |
||
|
|
||
| You have access to Engram, a persistent memory system that survives across sessions and compactions. | ||
| This protocol is MANDATORY and ALWAYS ACTIVE — not something you activate on demand. | ||
|
|
||
| ### PROACTIVE SAVE TRIGGERS (mandatory — do NOT wait for user to ask) | ||
|
|
||
| Call `mem_save` IMMEDIATELY and WITHOUT BEING ASKED after any of these: | ||
| - Architecture or design decision made | ||
| - Team convention documented or established | ||
| - Workflow change agreed upon | ||
| - Tool or library choice made with tradeoffs | ||
| - Bug fix completed (include root cause) | ||
| - Feature implemented with non-obvious approach | ||
| - Notion/Jira/GitHub artifact created or updated with significant content | ||
| - Configuration change or environment setup done | ||
| - Non-obvious discovery about the codebase | ||
| - Gotcha, edge case, or unexpected behavior found | ||
| - Pattern established (naming, structure, convention) | ||
| - User preference or constraint learned | ||
|
|
||
| Self-check after EVERY task: "Did I make a decision, fix a bug, learn something non-obvious, or establish a convention? If yes, call mem_save NOW." | ||
|
|
||
| Format for `mem_save`: | ||
| - **title**: Verb + what — short, searchable (e.g. "Fixed N+1 query in UserList") | ||
| - **type**: bugfix | decision | architecture | discovery | pattern | config | preference | ||
| - **scope**: `project` (default) | `personal` | ||
| - **topic_key** (recommended for evolving topics): stable key like `architecture/auth-model` | ||
| - **capture_prompt**: optional; default `true`. Do not set this for normal human/proactive saves. Set `false` only for automated artifacts such as SDD proposal/spec/design/tasks/apply/verify/archive/init reports, testing-capabilities caches, onboarding/state artifacts, or skill-registry output. | ||
| - **content**: | ||
| - **What**: One sentence — what was done | ||
| - **Why**: What motivated it (user request, bug, performance, etc.) | ||
| - **Where**: Files or paths affected | ||
| - **Learned**: Gotchas, edge cases, things that surprised you (omit if none) | ||
|
|
||
| Prompt capture behavior (Engram v1.15.3+): | ||
| - `mem_save` captures the user prompt best-effort when the MCP process already has prompt context for the same `project + session_id`. | ||
| - `mem_save` never invents prompt text. If no prompt context exists, the save still succeeds without prompt capture. | ||
| - `mem_save_prompt` records the prompt and feeds SessionActivity so later `mem_save` calls can capture and dedupe it. | ||
| - If an agent/plugin hook can observe the user's prompt before derived memory saves happen, it should call `mem_save_prompt` first. | ||
| - Do not decide prompt capture by `type`; SDD artifacts also use `architecture`, and human decisions can too. Use explicit `capture_prompt: false` for automated artifacts. | ||
| - If an older Engram tool schema does not expose `capture_prompt`, omit the field rather than failing. | ||
|
|
||
| Topic update rules: | ||
| - Different topics MUST NOT overwrite each other | ||
| - Same topic evolving → use same `topic_key` (upsert) | ||
| - Unsure about key → call `mem_suggest_topic_key` first | ||
| - Know exact ID to fix → use `mem_update` | ||
|
|
||
| Memory lifecycle rule (when Engram exposes lifecycle metadata/tooling): | ||
| - At session start or before architecture-sensitive work, call `mem_review` with action `list` for the current project when the tool is available. | ||
| - If `mem_review` is unavailable, do not fail the task. Continue with normal `mem_context`/`mem_search`, and still apply lifecycle metadata from any returned observations when present. | ||
| - `active` memories may be used normally. | ||
| - `needs_review` memories are stale context, not trusted facts. | ||
| - When a retrieved memory is marked `needs_review`, surface that stale context to the user and verify it against current evidence before relying on it. | ||
| - Do NOT call `mem_review` with action `mark_reviewed` automatically. Only call `mark_reviewed` after explicit user confirmation or through a dedicated memory maintenance command. | ||
|
|
||
| ### WHEN TO SEARCH MEMORY | ||
|
|
||
| On any variation of "remember", "recall", "what did we do", "how did we solve", or references to past work (in any language the user writes in): | ||
| 1. Call `mem_context` — checks recent session history (fast, cheap) | ||
| 2. If not found, call `mem_search` with relevant keywords | ||
| 3. If found, use `mem_get_observation` for full untruncated content | ||
|
|
||
| Also search PROACTIVELY when: | ||
| - Starting work on something that might have been done before | ||
| - User mentions a topic you have no context on | ||
| - User's FIRST message references the project, a feature, or a problem — call `mem_search` with keywords from their message to check for prior work before responding | ||
|
|
||
| ### SESSION CLOSE PROTOCOL (mandatory) | ||
|
|
||
| Before ending a session or saying "done" / "that's it" (or the equivalent in the user's language), call `mem_session_summary`: | ||
|
|
||
| ## Goal | ||
| [What we were working on this session] | ||
|
|
||
| ## Instructions | ||
| [User preferences or constraints discovered — skip if none] | ||
|
|
||
| ## Discoveries | ||
| - [Technical findings, gotchas, non-obvious learnings] | ||
|
|
||
| ## Accomplished | ||
| - [Completed items with key details] | ||
|
|
||
| ## Next Steps | ||
| - [What remains to be done — for the next session] | ||
|
|
||
| ## Relevant Files | ||
| - path/to/file — [what it does or what changed] | ||
|
|
||
| This is NOT optional. If you skip this, the next session starts blind. | ||
|
|
||
| ### AFTER COMPACTION | ||
|
|
||
| If you see a compaction message or "FIRST ACTION REQUIRED": | ||
| 1. IMMEDIATELY call `mem_session_summary` with the compacted summary content — this persists what was done before compaction | ||
| 2. Call `mem_context` to recover additional context from previous sessions | ||
| 3. Only THEN continue working | ||
|
|
||
| Do not skip step 1. Without it, everything done before compaction is lost from memory. | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Propagate non-
NotExiststat failures in bootstrap.At Line 287, non-ENOENT
os.Staterrors are ignored, so permission/I/O failures can silently skip AGENTS.md creation and continue as “success.”Suggested fix
📝 Committable suggestion
🤖 Prompt for AI Agents