Repository navigation
feat(memory): let a setting steer what consolidation keeps and never stores - #37166
Conversation
UX Review (Opus 5.5) — ⏭️ skippedRevision |
Design Review (Opus 5.5) — ✅ PASSDesign-level review of Design-Verdict: PASS Nothing blocks: the new key is optional and defaults to empty, so the prompt stays byte for byte the same, and one revert removes it. Notes
[DESIGN-REVIEWED] c4629a9 Description read[DESCRIPTION-READ] e640f8434ec8a51ba6103a1fe1007e90206ffd0d36915f64614bceb174637f46 That sha256 names everything this verdict read: the PR description, plus the 1 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with |
First Principles Review (Opus 5.5) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS Nothing blocks: the new setting is off by default, nothing else in the repo steers consolidation, and the prompt has a single place where the block is added. Notes
What this change shipsInventory (5 items) — 4 justifiedIntent: let the owner say in their own words what memory consolidation keeps and never stores. ADDITION.
[FIRST-PRINCIPLES-REVIEWED] c4629a9 Description read[DESCRIPTION-READ] 98af2825d56b9c8a23650196f91ee1b4efd4fcab24866480d38e0340ab15ab11 That sha256 names the PR description this verdict read. Recompute it with |
GPT 6.1 Review — ✅ no blocking findingsGPT 6.1 completed its review of This comment is updated in place on each push. Review detailsNo findings. False positive or not applicable? A repository writer can comment: |
Opus 5.5 Review — ✅ no blocking findingsReviewed Review detailsNo findings. Notes:
[OPUS-REVIEWED] c4629a9 Verdict parsed from the review's SHA-scoped output markers for commit False positive or not applicable? A repository writer can comment: |
…stores Add memory.extraction_instructions, free text the history consolidation prompt carries as one fenced block after the fixed rules. Empty (the default) leaves the prompt byte for byte as it was.
97b798b to
c4629a9
Compare
|
Rebased: onto main |
KiroCrewCaptain
left a comment
There was a problem hiding this comment.
Approving. On this head the review read the full diff and the single prompt assembly site in _consolidate. It found that an unset, empty, blank or wrong-typed setting leaves the prompt byte-identical on both the history and preferences-only passes. The new test file passed (17 tests). Mutation probes that drop or move the append, swap the while fence escape for an if, or skip load-time normalization each turn a test red. No open PR duplicates this work.
Done well: test_text_cannot_close_the_fence_early uses a hostile fake end marker plus a pasted ## Conversation to Process heading, so owner text provably stays inside its fence.
Optional:
docs/system-specs/modules/config.md:3612nameshistory_consolidation_span._extraction_guidance_block, which does not exist. The real owner ismemory_extraction_guidance.configured_guidance_block.memory_sections.py:656:isprintable()also deletes U+00A0, U+3000 and ZWJ/ZWNJ, so pasted text like "never store" becomes "neverstore". Mappingc.isspace()to a space first would keep the word breaks, and a test case could pin it.memory_extraction_guidance.py:44normalizes a value the loader already normalized, behind agetattrdefault for a field that always exists.guidance_block(KiroCrewConfig.load().memory.extraction_instructions)is enough.
Problem / Motivation (Goal)
Goal: a person can say, in their own words, what history consolidation should keep and what it must never store, for example "never store customer names" or "keep build commands".
Today every control on automatic memory is a switch:
memory.persistence_enabled,memory.writes_enabled,memory.lesson_extraction_enabled,memory.kind_routingand the lesson tier and origin policies. They decide whether a kind of write happens. None of them lets the owner shape what the extraction step looks for. The extraction prompt is fixed insrc/kiro_crew/history_consolidation_pass.py, so the only way to keep a topic out of memory is to turn a whole stage off, and the only way to keep a kind of fact in is to say "remember" every time.This adds one string setting,
memory.extraction_instructions. Empty (the default) changes nothing. Text is added to the consolidation prompt as one fenced block.Why it matters
Not a goal
learn_add, dashboard edits, or what the owner saves explicitly.config-baseline.json); a page field can follow.What changed (motivation → approach → change)
Symptom → cause: the extraction prompt has no place for owner text, so nothing the owner writes can reach it.
src/kiro_crew/config/memory_sections.py: new fieldmemory.extraction_instructions(default"") andextraction_instructions_from, which reads anything that is not text as empty, drops control characters other than newline and tab, trims, and cuts to 2,000 characters.src/kiro_crew/config/section_builders.py: the loader passes the value through that reader.src/kiro_crew/memory_extraction_guidance.py(new, 45 lines): builds the prompt block. The block names the text as the owner's, says it cannot change the JSON shape, key rules, limits or any rule above, and fences it. A run of three or more<or>inside the text is shortened so it cannot close the fence.src/kiro_crew/history_consolidation_pass.py: appends the block after the memory sections and before## Conversation to Process, on both the history pass and the preferences-only pass. An empty setting appends an empty string.config-baseline.json(regenerated withscripts/generate_config_baseline.py),docs/system-specs/modules/config.md,src/kiro_crew/docs/configuration.mdandsrc/kiro_crew/docs/memory-and-learning.mdlist the key.Backwards compatibility
With the setting empty or absent, the prompt is byte for byte what it was; a test pins that for unset,
"", whitespace and a wrong-typed value, on both passes, and it passes on main too. No stored data changes, and there is no new failure path: a value that is not text, or too long, is read as empty or cut, never refused. The key is new and optional, so older config files load as before.Tests
858863b5b0, where this branch was built (it is now rebased onto6a61c8465f, which still has no such setting), the new test file cannot importextraction_instructions_from. With that one import stubbed, 15 of the 17 cases fail (the setting and its reader do not exist, and a configured text does not reach the prompt) and the 2 cases that pin the empty-setting prompt pass.flake8,isortandmypypass on the changed files; the repo's black gate, comment-history gate, flake and wait ratchets, sync-io gate and the lane CI checks pass.python -m pytest test/test_memory_extraction_instructions.py -n0Manual verification
Run through
_prompt_for(the consolidation pass with a stubbed model call): with{"memory": {"extraction_instructions": "never store customer names; keep build commands"}}the prompt ends with the guidance block, then## Conversation to Process; removing exactly that block gives the prompt produced with no setting.Sibling sweep
Sibling:
src/kiro_crew/history_consolidation_pass.pyskill-detection pass -- not affected -- it runs as its own pass over a wider window and states its own rulesSibling:
src/kiro_crew/memory_kind_routing.py-- not affected -- it adds text only underenforce; the guidance block is independent and sits after itSibling:
src/kiro_crew/taskrunner.pylesson extraction -- not affected -- it does not use the consolidation promptPattern harvest
Rule candidate: review-prompt
Pattern: a new owner-supplied string that reaches a model prompt is normalized at load (type, control characters, length), fenced, and placed after the fixed rules; an empty value must append nothing.
Related Issues
None filed; the gap is the one in the Problem section, found by reading the memory switches and the extraction prompt.
Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)Contribution License Agreement