feat(cli): opt-in project memory - #11921
Conversation
cdbf820 to
5a76b43
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5a76b43bba
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Code Review SummaryStatus: No Issues Found | Recommendation: Merge Incremental review against previous review commit
No new issues found in the changed line. The one previously-flagged comment on this file ("This assert is duplicated or wrong", anchored at original line 254) is unrelated to this 1-line change — it targets a different location in the file, is already marked outdated ( Files Reviewed (incremental diff: 1 file)
Previous Review Summaries (7 snapshots, latest commit b98e0d6)Current summary above is authoritative. Previous snapshots are kept for context only. Previous review (commit b98e0d6)Status: No Issues Found | Recommendation: Merge Incremental review against previous review commit
No new issues found in the changed lines. The one active inline comment on a file touched by this diff ( Files Reviewed (incremental diff: 11 files)
Previous review (commit 78c98ac)Status: No Issues Found | Recommendation: Merge Incremental review against previous review commit
No new issues found in the changed lines. Files Reviewed (incremental diff: 4 files)
Previous review (commit 967fefe)Status: 5 Issues Found | Recommendation: Address before merge Overview
Incremental review against previous review commit Two new issues were found in the newly-added "fallback digest" / "template echo" detection logic and one test: Issue Details (click to expand)WARNING
SUGGESTION
Files Reviewed (incremental diff: 26 files)
Fix these issues in Kilo Cloud Previous review (commit a551bb9)Status: No Issues Found | Recommendation: Merge Incremental review against previous review commit All 4 previously flagged SUGGESTIONs are resolved in this diff:
Additionally, No new issues found in the changed lines. Files Reviewed (incremental diff: 4 files)
Previous review (commit cd881dd)Status: 4 Issues Found | Recommendation: Address before merge Overview
Incremental review against the previous review commit All new findings are low-severity SUGGESTIONs; no correctness bugs, security issues, or unhandled error paths were found in the changed lines. Highlights:
Verified as correct / no new issues in this diff:
Issue Details (click to expand)SUGGESTION
Files Reviewed (incremental diff: 17 files)
Fix these issues in Kilo Cloud Previous review (commit 914ebf5)Status: No Issues Found | Recommendation: Merge OverviewIncremental review against the previous review commit Changes verified as correct, tested fixes / refactors with no new issues:
Two previously-flagged items from the prior review remain open and untouched by this diff (confirmed unchanged at their current lines), so they are left on their existing threads rather than re-reported:
Files Reviewed (incremental diff: 11 files)
Previous review (commit 4cee27b)Status: 2 Issues Found | Recommendation: Address before merge OverviewBranch history was rewritten again since the last review (the prior base Of the previously-open items carried from the last review round (topics.ts corpus threshold, redact.ts plural-keyword regression, redact.ts colon-separated low-entropy secrets, reject.ts clause-boundary punctuation, parse.ts salvageText empty-field precedence, indexer.ts redundant covered() computation + uncapped coveredDigests, httpapi.ts payload length caps, memory-save.ts misleading config-file copy), all were independently re-verified against the current code and are now genuinely fixed. One previously-flagged item is only partially fixed: One new issue was found in this round, in a file not previously reviewed in depth: the new Overview
Issue Details (click to expand)WARNING
SUGGESTION
Files Reviewed (full PR: 91 files)
[Snapshot truncated.] Additional previous summary content was truncated to keep this comment within platform limits. Reviewed by claude-sonnet-5-20260630 · Input: 26 · Output: 4.9K · Cached: 578.9K Review guidance: REVIEW.md from base branch |
61543e1 to
7219abb
Compare
26ac254 to
380231c
Compare
380231c to
70cb07c
Compare
4e33bca to
8fcb796
Compare
cf5b764 to
c2a50e0
Compare
…gration Add project memory: the standalone @kilocode/kilo-memory effect layer plus the opencode CLI/server/TUI integration. Memory is disabled by default, so it is a no-op until enabled (no behavior change when off). Capture (turn-close consolidation): per-op parse salvage, secret redaction that skips the offending op instead of aborting the batch, supersede-only auto-updates (never model-driven deletes), correction-aware echo handling, non-LLM fallback digests on interrupted/error turns, a shared interval throttle with idle-flush. Recall + injection: keyword tokenizer with camelCase/compound splitting, light stemming, and an English-first stopword filter (Unicode-aware; non-English falls back to plain token-overlap), a live relevance floor, a budget-reserved startup index, a session-digest catalog, and per-session prompt-cache pinning of the injected memory block. Surfaces: kilo_memory_save / kilo_memory_recall tools, the memory HTTP API (contract schemas live in the package), and a status-focused TUI sidebar showing auto-save, loaded context, and active recall, plus the /memory dialog.
4ef1eac to
08bcde9
Compare
- C1: bump @kilocode/kilo-memory in the changeset - C2: redact secrets before they hit the audit log (skip + salvage paths); redact before truncating in salvageTyped so a secret straddling the 500-char cap can't leak an unmatched fragment; opText -> salvageText - C3: de-abbreviate savedOperations, "changes" wording, ops.ts -> operations.ts - C4: log.warn on the remaining silent-catch fallbacks (turn diff, memory context injection, tool-visibility check) - C5: relocate memory storage from ~/.kilo to Global.Path.data, delete the now-dead needsDependencyInstall guard, add /memory status (root path) and /memory edit ($VISUAL/$EDITOR + auto-rebuild) - C6: replace the hardcoded English stopword list with corpus-derived ubiquitous-term filtering (df across the user's own entries) and the English suffix stemmer with suffix-tolerant term matching, so recall noise-filtering works in any language - C8: delete the CORRECTION_INTENT English regex; echo turns now run typed capture (digest stays echo-gated), bounded by the interval throttle, with the typed prompt as the language-agnostic content filter - C9: exclude generated paths (dist/build/coverage/*.gen.*/*.map/snapshots) from the durable-diff churn fallback so generated churn can't burn a consolidation call - C11: fix duplicated assert in httpapi-memory test; assert the error body - kilo-code-bot batch: clause-boundary regex fix, byte-safe catalog truncation, max-length guards on remember/correct/forget payloads (text, query, key, sessionID), trim consistency in reconcile, param-shadowing rename, missing doc entry for kilo_memory_recall, dead-code removal, dialog UI fixes, memoryEnabledCache eviction bound, dedicated Configure schema, recall permission renderer, covered-session pointer cap, redact chat transcript before the consolidation model call, split configProtected metadata from disableAlways so memory-save prompts don't show config-file copy, drop unused MemoryService.layer provide from tool registry - redact colon-separated low-entropy secrets too (password: hunterx), accepting the prose false-positive tradeoff (secret: enabled) in favor of not missing a real secret - rename lastConsolidatedAt -> lastTypedConsolidationAt to make its narrow scope (typed-consolidation throttle clock) explicit; regen openapi/SDK - drop now-dead home/config fields from MemoryPaths.Host after the data-dir relocation; add Process.splitCommand for quoted $EDITOR/$VISUAL paths with spaces, used by /memory edit and the pre-existing Editor.open utility
08bcde9 to
4cee27b
Compare
914ebf5 to
cd881dd
Compare
cd881dd to
a551bb9
Compare
1223d2c to
967fefe
Compare
967fefe to
78c98ac
Compare
78c98ac to
b98e0d6
Compare
…X rework - extract client-side derivations into kilo-memory so both frontends share one implementation: MemoryDecisions.summarize (decision-log summary), MemoryAutosaveStatus.summarize (autosave-status semantics), and MemoryMarkerMeta (marker wire contract encode/decode) - match exact-key upserts via the canonical stored id (slugged key, normalized section) so a re-emitted spaced/uppercase key updates the entry instead of falling to fuzzy dedupe - salvageTyped throws on valid JSON without an operations array so the caller's fallback path records a parse error instead of a silent zero-op success - rename memory tool metadata files -> sources (stripPartMetadata rewrites tool-part metadata.files assuming apply_patch records, mangling string[]) - read state instead of status for tool enabled checks; dedupe TUI helpers (errorMessage, shared route(), Locale.number, relativeTime) - /memory UX: bare /memory opens a help modal driven by a structured command catalog in kilo-memory; /memory on|off become the canonical toggle verbs (enable/disable kept as quiet aliases); /memory status opens a clean overview dialog (root path, autosave, startup context, source counts, index size) instead of a toast; /memory show is the single full audit view (inspect removed)
b98e0d6 to
91de774
Compare
* feat(memory): opt-in project memory — capture, recall, CLI + TUI integration Add project memory: the standalone @kilocode/kilo-memory effect layer plus the opencode CLI/server/TUI integration. Memory is disabled by default, so it is a no-op until enabled (no behavior change when off). Capture (turn-close consolidation): per-op parse salvage, secret redaction that skips the offending op instead of aborting the batch, supersede-only auto-updates (never model-driven deletes), correction-aware echo handling, non-LLM fallback digests on interrupted/error turns, a shared interval throttle with idle-flush. Recall + injection: keyword tokenizer with camelCase/compound splitting, light stemming, and an English-first stopword filter (Unicode-aware; non-English falls back to plain token-overlap), a live relevance floor, a budget-reserved startup index, a session-digest catalog, and per-session prompt-cache pinning of the injected memory block. Surfaces: kilo_memory_save / kilo_memory_recall tools, the memory HTTP API (contract schemas live in the package), and a status-focused TUI sidebar showing auto-save, loaded context, and active recall, plus the /memory dialog. * fix(memory): address PR review feedback - C1: bump @kilocode/kilo-memory in the changeset - C2: redact secrets before they hit the audit log (skip + salvage paths); redact before truncating in salvageTyped so a secret straddling the 500-char cap can't leak an unmatched fragment; opText -> salvageText - C3: de-abbreviate savedOperations, "changes" wording, ops.ts -> operations.ts - C4: log.warn on the remaining silent-catch fallbacks (turn diff, memory context injection, tool-visibility check) - C5: relocate memory storage from ~/.kilo to Global.Path.data, delete the now-dead needsDependencyInstall guard, add /memory status (root path) and /memory edit ($VISUAL/$EDITOR + auto-rebuild) - C6: replace the hardcoded English stopword list with corpus-derived ubiquitous-term filtering (df across the user's own entries) and the English suffix stemmer with suffix-tolerant term matching, so recall noise-filtering works in any language - C8: delete the CORRECTION_INTENT English regex; echo turns now run typed capture (digest stays echo-gated), bounded by the interval throttle, with the typed prompt as the language-agnostic content filter - C9: exclude generated paths (dist/build/coverage/*.gen.*/*.map/snapshots) from the durable-diff churn fallback so generated churn can't burn a consolidation call - C11: fix duplicated assert in httpapi-memory test; assert the error body - kilo-code-bot batch: clause-boundary regex fix, byte-safe catalog truncation, max-length guards on remember/correct/forget payloads (text, query, key, sessionID), trim consistency in reconcile, param-shadowing rename, missing doc entry for kilo_memory_recall, dead-code removal, dialog UI fixes, memoryEnabledCache eviction bound, dedicated Configure schema, recall permission renderer, covered-session pointer cap, redact chat transcript before the consolidation model call, split configProtected metadata from disableAlways so memory-save prompts don't show config-file copy, drop unused MemoryService.layer provide from tool registry - redact colon-separated low-entropy secrets too (password: hunterx), accepting the prose false-positive tradeoff (secret: enabled) in favor of not missing a real secret - rename lastConsolidatedAt -> lastTypedConsolidationAt to make its narrow scope (typed-consolidation throttle clock) explicit; regen openapi/SDK - drop now-dead home/config fields from MemoryPaths.Host after the data-dir relocation; add Process.splitCommand for quoted $EDITOR/$VISUAL paths with spaces, used by /memory edit and the pre-existing Editor.open utility * refactor(memory): shared client helpers, capture hardening, /memory UX rework - extract client-side derivations into kilo-memory so both frontends share one implementation: MemoryDecisions.summarize (decision-log summary), MemoryAutosaveStatus.summarize (autosave-status semantics), and MemoryMarkerMeta (marker wire contract encode/decode) - match exact-key upserts via the canonical stored id (slugged key, normalized section) so a re-emitted spaced/uppercase key updates the entry instead of falling to fuzzy dedupe - salvageTyped throws on valid JSON without an operations array so the caller's fallback path records a parse error instead of a silent zero-op success - rename memory tool metadata files -> sources (stripPartMetadata rewrites tool-part metadata.files assuming apply_patch records, mangling string[]) - read state instead of status for tool enabled checks; dedupe TUI helpers (errorMessage, shared route(), Locale.number, relativeTime) - /memory UX: bare /memory opens a help modal driven by a structured command catalog in kilo-memory; /memory on|off become the canonical toggle verbs (enable/disable kept as quiet aliases); /memory status opens a clean overview dialog (root path, autosave, startup context, source counts, index size) instead of a toast; /memory show is the single full audit view (inspect removed)
Context
Adds opt-in project memory to the CLI so Kilo can persist durable project facts, corrections, environment notes, and session digests, then inject or recall them in later turns. The diff keeps reusable memory behavior in
packages/kilo-memoryand limits shared opencode changes to narrow wiring hooks.Implementation
The memory package owns the core behavior: schemas, storage/state, capture planning/parsing, redaction/rejection, recall/indexing, Effect services, HTTP API types, and the concrete recall/save tool logic.
The opencode Kilo-owned paths add host integration: TUI memory commands, sidebar/dialog/palette UI, HTTP handlers, memory runtime wiring, session prompt injection/pinning, tool registration, and thin wrappers for
kilo_memory_recall/kilo_memory_save.Shared opencode files are only small annotated hooks for prompt injection, TUI registration, memory tool visibility, HTTP API registration, permission rendering, and Effect layer provisioning. SDK/OpenAPI files are generated from the new memory endpoints.
Screenshots / Video
memory.mov
/memory/memory statusHow to Test
Manual/local verification
Agent-run checks:
packages/kilo-memory:bun run typecheckpackages/kilo-memory:bun testpackages/opencode:bun run typecheckpackages/opencode:bun test test/kilocode/memory/memory-ports.test.ts test/kilocode/memory/memory-integration.test.tspackages/opencode:bun test test/kilocode/cli/cmd/tui/memory-command.test.tspackages/opencode:bun test test/kilocode/tool/memory-recall.test.ts test/kilocode/tool/memory-save.test.tspackages/opencode:bun test test/kilocode/server/httpapi-memory.test.tspackages/opencode:bun test test/kilocode/memory/memory-recall-tool.test.tsbefore test relocationpackages/opencode:bun test test/kilocode/memory/memory-save-tool.test.ts test/kilocode/memory/memory-core.test.tsbefore test relocationgit diff --checkbun turbo typecheck --filter=!@kilocode/kilo-jetbrainsbun turbo typecheck --filter=@kilocode/kilo-jetbrainsReviewer test steps
/memory enableand confirm memory status/sidebar appears./memory remember <project fact>and confirm the saved-memory toast appears.kilo_memory_recallcan return the fact./memory auto off, then/memory auto status, and confirm auto-save state changes./memory disableand confirm memory is no longer injected or available to recall.Checklist