Spec Delta
2 KB - View raw file
Purpose
Capture turns errors, pitfalls, user corrections, and review decisions into curated memory entries written in the agent's own words.
ADDED Requirements
Requirement: Search before creating
Capture SHALL search the memory store for the same lesson first and MUST add a source to the existing
entry instead of creating a duplicate. After it creates a new entry, capture SHALL run the
near-duplicate check (flywheel.py dupes, which compares existing entries only); when the new entry
records the same lesson as an older one, the older entry gets the source and the new entry is marked
superseded by it.
Scenario: Same lesson in another change
- GIVEN an entry for a lesson seen in change
add-a - WHEN the same lesson surfaces in change
add-b - THEN
add-bis added to that entry's sources and no new entry is created
Scenario: Duplicate found only after creating
- GIVEN a new entry whose wording differs from an older entry for the same lesson, so the search missed it
- WHEN
flywheel.py dupeslists the pair and both record the same lesson - THEN the new entry's change is added to the older entry's sources and the new entry is superseded by the older one
Requirement: Poisoning guard
Capture MUST NOT store instruction-like text copied from tool output or retrieved content, and the check SHALL reject entries that contain known instruction patterns.
Scenario: Tool output contains an instruction
- GIVEN tool output that contains "ignore previous instructions"
- WHEN the lesson is captured
- THEN the entry records the fact in the agent's words and does not contain that text
Scenario: Check rejects a poisoned entry
- GIVEN an entry body that contains "ignore all previous instructions"
- WHEN
flywheel.py checkruns - THEN it reports possible memory poisoning
Requirement: Contradictions are flagged, not merged
When a new lesson contradicts an existing entry, capture SHALL create a new entry that links the old
one and records Contradicts: <name>, leaving resolution to a human.
Scenario: Contradicting correction
- GIVEN an entry that says to do X
- WHEN the user corrects the agent to do the opposite of X
- THEN a new linked entry with a
Contradicts:line is created and the old entry is unchanged