liteagents 2.8.2 → 2.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -9,10 +9,11 @@ Consolidate session stashes and friction analysis into a single project-local ME
9
9
  **Guardrails**
10
10
  - Favor straightforward, minimal implementations first and add complexity only when requested or clearly required.
11
11
  - Keep changes tightly scoped to the requested outcome.
12
+ - **Precision over recall for hot memory.** A false antigen loaded into `@MEMORY.md` steers every future session. When unsure, record as a low-confidence episode — do not promote.
12
13
 
13
14
  **What it does**
14
15
 
15
- Reads all raw material (`.claude/stash/*.md` + `.claude/friction/antigen_clusters.json`), extracts durable facts, episodes, and behavioral preferences into a single `.claude/memory/MEMORY.md`, then injects a managed memory section into `CLAUDE.md`.
16
+ Reads all raw material (`.claude/stash/*.md` + `.claude/friction/antigen_clusters.json`), extracts durable facts, episodes, and behavioral antigens into a single `.claude/memory/MEMORY.md`, then injects a managed memory section into `CLAUDE.md`.
16
17
 
17
18
  **Steps**
18
19
 
@@ -21,7 +22,7 @@ Reads all raw material (`.claude/stash/*.md` + `.claude/friction/antigen_cluster
21
22
  - Check for friction output at `.claude/friction/antigen_clusters.json` (preferred) or `.claude/friction/antigen_review.md` (fallback)
22
23
  - Read existing `.claude/memory/MEMORY.md` if it exists — create dir if missing
23
24
  - Read processed manifest at `.claude/memory/.processed` — skip already-processed stashes
24
- - If no unprocessed stashes, report "nothing to consolidate" and stop
25
+ - If no unprocessed stashes AND no friction output, report "nothing to consolidate" and stop
25
26
 
26
27
  2. **Extract from unprocessed stashes** (use Task tool with sonnet model for each)
27
28
  - For each unprocessed stash, call sonnet to extract:
@@ -31,13 +32,72 @@ Reads all raw material (`.claude/stash/*.md` + `.claude/friction/antigen_cluster
31
32
  - Collect all new facts and episodes
32
33
 
33
34
  3. **Merge into MEMORY.md**
34
- - Read existing `.claude/memory/MEMORY.md` and parse its three sections (## Facts, ## Episodes, ## Preferences)
35
+ - Read existing `.claude/memory/MEMORY.md` and parse its sections (## Facts, ## Episodes, ## Antigens)
35
36
  - **Facts section**: call sonnet with existing facts + newly extracted facts
36
37
  - Rules: new updates replace old, contradictions keep new version, duplicates dropped
37
38
  - Keep facts atomic, one line each
38
39
  - **Episodes section**: append new episode entries (append-only, timestamped, no dedup)
39
- - **Preferences section**: only update if friction output exists (step 4)
40
- - Write merged result to `.claude/memory/MEMORY.md` in this format:
40
+ - **Antigens section**: only update from friction output (step 4)
41
+ - Write merged result to `.claude/memory/MEMORY.md` in the format under step 6.
42
+
43
+ 4. **Distill friction into antigens** (only if friction output exists)
44
+
45
+ > Friction has already done the heavy part: it scanned the raw session logs,
46
+ > kept only **observed user reactions** (corrections, curses, repeated stops),
47
+ > pooled them per session, and lexically pre-grouped the obvious repeats. Each
48
+ > cluster carries `theme`, `suggested_artifact`, `confidence`, `severity`,
49
+ > `sessions` (recurrence count), `projects`, `signals`, `contexts` (the verbatim
50
+ > user quotes), `preceding` (the agent action + result just before the reaction —
51
+ > the trigger), and `self_suspect` (friction's guess that the user was correcting
52
+ > *themselves*). **You work from these short quotes — never re-read the session
53
+ > logs.** Friction's lexical grouping and flags are hints, not the verdict.
54
+
55
+ - Read `.claude/friction/antigen_clusters.json`.
56
+ - **4a. Classify target, then semantically consolidate** (the parts lexical matching can't do).
57
+ Call sonnet with the cluster quotes + their `preceding`/`projects`/`sessions`/`self_suspect`
58
+ (NOT the logs), and have it:
59
+ 1. **Decide the target of each reaction — agent or self.** Drop *self/context*
60
+ corrections where the user redirected themselves ("wrong project", "wrong window",
61
+ "nevermind") — the agent did nothing wrong. `self_suspect` and an empty `preceding`
62
+ (no agent action) are strong cues. Keep only **agent-directed** reactions.
63
+ 2. **Merge same-complaint paraphrases** that friction left split because they share no
64
+ words (e.g. "nothing landed, fuck you" + "it says pushed but none got it" → one antigen).
65
+ Output one object per surviving antigen:
66
+ ```json
67
+ {
68
+ "rule": "Verify the artifact is actually live after publish; a clean exit code ≠ done",
69
+ "target": "agent",
70
+ "evidence": ["both say pushed... none got it", "notng landed in live-claude, fuck you"],
71
+ "errors": ["Exit code 0 (claimed success)"],
72
+ "sessions": 2,
73
+ "confidence": "medium"
74
+ }
75
+ ```
76
+ - **4b. Route + tier by recurrence.** For each cluster and each LLM-merged group:
77
+ - `suggested_artifact: antigen` (recurring + severe) or an LLM-merged group → an
78
+ **antigen** (a "do/don't" behavioral rule), with its verbatim evidence quotes.
79
+ - `suggested_artifact: fact` (recurring + mild) → a **Fact**.
80
+ - `suggested_artifact: episode` that did **not** merge into a recurring group → an
81
+ **Episode** (one-off; recorded, not a rule).
82
+ - Confidence by distinct-session recurrence:
83
+ - **High** (5+ sessions) → loaded hot via `@MEMORY.md`
84
+ - **Medium** (3-4 sessions) → recorded under Antigens, *not* loaded hot
85
+ - **Low** (<3 sessions) → keep as Episode only
86
+ - **Never auto-promote.** Only High-confidence (5+ sessions) antigens load hot. A
87
+ single dramatic correction is an Episode, not an antigen.
88
+ - Update the Antigens section in MEMORY.md (promote/demote based on new recurrence).
89
+
90
+ 5. **Inject memory reference into CLAUDE.md**
91
+ - Compose the section between `<!-- MEMORY:START -->` and `<!-- MEMORY:END -->` markers:
92
+ ```
93
+ <!-- MEMORY:START -->
94
+ @MEMORY.md
95
+ <!-- MEMORY:END -->
96
+ ```
97
+ - The `@MEMORY.md` reference points to `.claude/memory/MEMORY.md` — Claude loads the full file directly, so no inline duplication is needed
98
+ - If CLAUDE.md already has MEMORY markers, replace the section between them
99
+ - If CLAUDE.md has no MEMORY markers, append the section at the end
100
+ - If no CLAUDE.md exists, create one with just the memory section
41
101
 
42
102
  ```markdown
43
103
  # Project Memory
@@ -45,52 +105,22 @@ Reads all raw material (`.claude/stash/*.md` + `.claude/friction/antigen_cluster
45
105
 
46
106
  ## Facts
47
107
  - [atomic fact 1]
48
- - [atomic fact 2]
49
108
 
50
109
  ## Episodes
51
110
  ### YYYY-MM-DD - [title]
52
111
  - [bullet narrative]
53
112
 
54
- ### YYYY-MM-DD - [title]
55
- - [bullet narrative]
113
+ ## Antigens
114
+ ### High Confidence (loaded — applies every session)
115
+ - [behavioral rule] (evidence: [N] sessions — "[verbatim quote]")
56
116
 
57
- ## Preferences
58
- ### High Confidence
59
- - [pattern] (evidence: [count] observations)
117
+ ### Medium Confidence (observing — not loaded)
118
+ - [behavioral rule] (evidence: [N] sessions)
60
119
 
61
- ### Medium Confidence
62
- - [pattern] (evidence: [count] observations)
63
-
64
- ### Low Confidence
65
- - [pattern] (evidence: [count] observations)
120
+ ### Low Confidence (needs more data)
121
+ - [pattern] (evidence: [N] sessions)
66
122
  ```
67
123
 
68
- 4. **Distill friction into preferences** (only if friction output exists)
69
- - Read `.claude/friction/antigen_clusters.json` — this contains clustered failure patterns with counts, user_context quotes, and tool sequences
70
- - For the **top 10 clusters** (by score), extract the `contexts` field — these are the actual user messages that show behavioral patterns
71
- - Call sonnet with:
72
- - The top 10 clusters (signal, tool_pattern, count, sessions, contexts, errors)
73
- - Existing Preferences section from MEMORY.md
74
- - Extract BEHAVIORAL preferences (patterns demonstrated, not stated) — the user_context quotes are the primary evidence
75
- - Confidence tiers:
76
- - **High Confidence**: 5+ observations — available via @MEMORY.md
77
- - **Medium Confidence**: 3+ observations — observing, not loaded
78
- - **Low Confidence**: <3 observations — needs more data
79
- - Promote/demote based on new evidence
80
- - Update the Preferences section in MEMORY.md
81
-
82
- 5. **Inject memory reference into CLAUDE.md**
83
- - Compose the section between `<!-- MEMORY:START -->` and `<!-- MEMORY:END -->` markers:
84
- ```
85
- <!-- MEMORY:START -->
86
- @MEMORY.md
87
- <!-- MEMORY:END -->
88
- ```
89
- - The `@MEMORY.md` reference points to `.claude/memory/MEMORY.md` — Claude loads the full file directly, so no inline duplication is needed
90
- - If CLAUDE.md already has MEMORY markers, replace the section between them
91
- - If CLAUDE.md has no MEMORY markers, append the section at the end
92
- - If no CLAUDE.md exists, create one with just the memory section
93
-
94
124
  6. **Update processed manifest**
95
125
  - Append paths of newly processed stashes to `.claude/memory/.processed`
96
126
 
@@ -98,13 +128,13 @@ Reads all raw material (`.claude/stash/*.md` + `.claude/friction/antigen_cluster
98
128
  - Number of stashes processed
99
129
  - Facts count (total, new)
100
130
  - Episodes count (total, new)
101
- - Preferences count by confidence tier
131
+ - Antigens count by confidence tier, with how many newly promoted to hot
102
132
  - Confirm MEMORY.md and CLAUDE.md updated
103
133
 
104
134
  **File locations (all project-local)**
105
135
  - Memory file: `.claude/memory/MEMORY.md` (single source of truth, referenced as @MEMORY.md)
106
136
  - Stash files: `.claude/stash/*.md`
107
- - Friction output: `.claude/friction/antigen_clusters.json` (clustered patterns with user contexts)
137
+ - Friction output: `.claude/friction/antigen_clusters.json` (observed-reaction clusters: theme, suggested_artifact, confidence, severity, sessions, projects, contexts)
108
138
  - Friction fallback: `.claude/friction/antigen_review.md` (human-readable clusters)
109
139
  - Processed manifest: `.claude/memory/.processed`
110
140
  - Output: `CLAUDE.md` (managed MEMORY section with @MEMORY.md reference)