feat(memory): ICM slice 2 — feedback record/search/stats#579
Merged
Conversation
Adds the cross-agent "AI predicted X, real answer was Y" feedback lane specified in docs/icm-integration-plan.md slice 2 so a future agent can search prior corrections by topic before repeating a known mistake. - packages/storage migration 015 introduces `feedback` + a porter- unicode61 `feedback_fts` virtual table with the standard ai/ad/au triggers, plus indexes on `topic` and `created_at`. Importance is a four-level CHECK enum defaulting to `medium`. - packages/core MemoryStore exposes `recordFeedback`, `searchFeedback`, `getFeedback`, and `feedbackStats`. All three prose fields (prediction/correction/context) route through `prepareMemoryText`, the same redact-then-compress path observations use, so the compression invariant holds at the write boundary. - apps/mcp-server registers `feedback_record`, `feedback_search`, and `feedback_stats` with progressive-disclosure return shapes (id, topic, importance, FTS5 score, snippet, created_at). docs/mcp.md carries the contract. Follow-up out of scope here: a pre-tool-use hook that auto-surfaces prior corrections on inbound prompts. Tracking separately so this slice can ship behind a manual query surface first.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
ICM slice 2 (see
docs/icm-integration-plan.md) — adds a cross-agent "AI predicted X, real answer was Y" feedback lane so a future agent can search prior corrections by topic before repeating a known mistake. Mirrors the observation surface:feedback_record(compressed write),feedback_search(compact FTS5 hits),feedback_stats(per-topic counts).feedback+ a porter-unicode61feedback_ftsvirtual table with the standardai/ad/autriggers, plus indexes ontopicandcreated_at. Importance is a four-level CHECK enum (critical|high|medium|low, defaultmedium).MemoryStore.recordFeedbackroutesprediction/correction/contextthrough the sameprepareMemoryTextpipeline observations use, so the compression invariant holds at the write boundary.getFeedbackhonorssettings.compression.expandForModel(and an explicitexpandopt).docs/mcp.mddocuments the contract.Verification
Run from this worktree:
pnpm --filter @colony/storage typecheck— passpnpm --filter @colony/storage test— pass (174/174, including newfeedback.test.ts)pnpm --filter @colony/core typecheck— passpnpm --filter @colony/core test— 254/255; the one failure (test/savings-reference.test.ts > does not attribute structured-output savings_report calls to the at-rest compression row) is pre-existing onmain— reproduces with my changes stashed.pnpm --filter @colony/mcp-server typecheck— passpnpm --filter @colony/mcp-server test— pass (302/302, including newfeedback.test.tsand the updatedserver.test.tstool-list expectation)pnpm exec biome checkon touched files — clean; the lone diagnostic that remains is the pre-existingpackages/storage/src/storage.ts::mcpMetricsMinTsformatter quirk that is unrelated to this change.Test plan
Follow-up (out of scope)
References
docs/icm-integration-plan.md— slice 2 spec (not authored in this PR; this implements it as written).