Skip to content

Triage batch 1: backpressure, eviction, project scoping and 10 more fixes - #57

Merged
possiblyneal merged 17 commits into
mainfrom
fix/triage-batch-1
Sep 26, 2026
Merged

possiblyneal merged 17 commits into
mainfrom
fix/triage-batch-1

Conversation

@possiblyneal

@possiblyneal possiblyneal commented Sep 25, 2026 •

Copy link
Copy Markdown
Owner

Fixes picked from docs/upstream-issue-triage.yaml and docs/upstream-pr-triage.yaml. Each fixed row is re-scored as already-fixed with its commit. 2e3e215 also records rows verified as already fixed in this tree (rohitg00#938, rohitg00#1020, rohitg00#1047, rohitg00#1163, rohitg00#1180, rohitg00#1335, rohitg00#1341, rohitg00#969, PR rohitg00#1005), with the code that fixes them as evidence.

What changes for you

Fix Commit Consequence
PR rohitg00#1259: LLM backpressure 042f3a1 A burst of 429s no longer switches summarising off for minutes. Calls wait out Retry-After, and AGENTMEMORY_LLM_MAX_CONCURRENCY (default 4) caps how many run at once. A 429 for an exhausted OpenAI quota still opens the breaker.
Summarize tokenize skip 385ab26 Short sessions skip the /tokenize round-trip, so no more "Token count failed" warnings for them.
rohitg00#1278: PreToolUse envelope 895d01c Claude Code actually shows recalled context before a tool call, instead of dropping it.
PR rohitg00#1287: daily Eviction 3b2545e Stale and low-value Memory is swept 5 min after boot and then every 24h, so the store stops growing without bound. It is on by default; EVICTION_ENABLED=false opts out.
rohitg00#1065: lesson recall 98d246c Lessons whose confidence decayed low are still recalled. A lesson that decays to ≤0.1 with no reinforcements is still retired by the decay sweep, as before. The issue's "N lessons hidden" notice is not added.
PR rohitg00#1176: audit pruning cc30b8e The audit log keeps the newest AGENTMEMORY_AUDIT_MAX rows (default 50000), trimmed 5 min after boot and then daily, so it no longer grows forever.
rohitg00#1292: lesson extraction 0a4874a Imported lessons are whole sentences, not fragments, and re-importing a transcript no longer props up a lesson that should decay.
rohitg00#1219: OpenAI token param b0b25f9 api.openai.com reasoning models stop rejecting requests. Compatible servers still get max_tokens.
rohitg00#993: self-capture b082b94 agentmemory's own MCP calls stay out of search results. Clear AGENTMEMORY_INDEX_EXCLUDE_TOOL_PREFIXES to index them again.
rohitg00#1064: phantom Sessions 2f99c65 Importing transcripts no longer creates Sessions for Claude Code's "Warmup" and list-summary side calls.
PR rohitg00#1174: Session cap db9f5db A long Session at the observation cap keeps recording: the least important observation is evicted (and audited) instead of the new one being dropped.
rohitg00#1344: project-scoped consolidation 6575de0, 585f7f0 Scheduled consolidation merges and reflects each project on its own, so insights about one repo no longer draw on another's facts. A project whose run failed is retried on the next one.
rohitg00#728: worktree projects 1dc4d43 Every git worktree of a repo files its Sessions under the main checkout's name, so Memory from one worktree is recalled in the others.

After merging

  • Restart the daemon: systemctl --user restart agentmemory. It runs from this checkout's dist/.
  • The first Eviction sweep runs 5 minutes after boot. On the current store, expect roughly 560 catch-up summaries. Setting AGENTMEMORY_LLM_MAX_CONCURRENCY=2 in ~/.agentmemory/.env keeps that burst gentle on the provider.
  • No data is migrated:
    • The 9,858 existing insights with no project stay as they are.
    • Sessions already filed under a worktree name (e.g. a fish name) keep that name.
    • Only new Sessions and new insights get the new behaviour.

Behaviour notes

  • mem::consolidate-pipeline now returns results.semantic and results.reflect keyed by project. An unscoped run (the timer, or session stop) only processes projects with summaries newer than the last unscoped run.
  • The hooks in plugin/scripts/*.mjs were rebuilt with npm run build.

Review

Standard review (standards, spec, correctness/logic) fixes are in 585f7f0: the timers now run after boot, retries on failure, shared facts, the quota 429, dense text in the tokenize skip, audited cap eviction, glossary naming, and CRLF restored.

Verification

  • npm test: 2013 passed, 1 skipped.
  • tsc --noEmit: unchanged at 20 errors, all pre-existing.
  • Every new test was checked to fail against the unfixed code.

🤖 Generated with Claude Code

neal added 17 commits September 25, 2026 18:29
A busy self-hosted backend (429 queue_full, Retry-After: 30) tripped the
summarize breaker after three calls, so every summary for the next 30s
failed with circuit_breaker_open. Providers now throw ProviderHttpError
carrying the status; ResilientProvider does not count 429/503 as a
failure. Retry-After is honored in full when it fits the call's budget
instead of being cut to 5s. All LLM calls share one slot pool,
AGENTMEMORY_LLM_MAX_CONCURRENCY (default 4).

Upstream PR#1259.

Generated-By: Claude Opus 5.5 (1M context)
countObservationTokens sent one /tokenize per Observation, 16 at a time,
on every summarize. On a broker that schedules tokenize beside generation
those calls queued, timed out (1331 in three days) or drew 429s (205),
adding load in front of the summary they were measuring. Only 12 of ~1800
summaries needed more than one chunk. The chars/3 estimate overcounts, so
when it fits the budget the Session is summarized without measuring.

Generated-By: Claude Opus 5.5 (1M context)
Claude Code writes plain PreToolUse stdout to the debug log and never
shows it to the model, so AGENTMEMORY_INJECT_CONTEXT=true fetched
/enrich on every file tool call for nothing. When the payload names
hook_event_name "PreToolUse" the context now goes out as
hookSpecificOutput.additionalContext; hosts that send no event name keep
the plain text.

Upstream rohitg00#1278.

Generated-By: Claude Opus 5.5 (1M context)
mem::evict was registered but no timer called it, so Eviction only ran
when someone POSTed /agentmemory/evict. It now runs every 24h beside
the lesson and insight decay sweeps; EVICTION_ENABLED=false opts out.

Upstream PR#1287.

Generated-By: Claude Opus 5.5 (1M context)
lesson-recall defaulted minConfidence to 0.1 while the decay sweep floors
a reinforced lesson at 0.05 and keeps it live, so every correction old
enough to have decayed was invisible to default recall. The default is
now 0, matching lesson-list; soft-delete remains the gate and confidence
still ranks decayed lessons last.

Upstream rohitg00#1065.

Generated-By: Claude Opus 5.5 (1M context)
recordAudit wrote a row per state change and nothing ever removed one,
so mem:audit grew for the life of the install. A daily sweep now keeps
the newest AGENTMEMORY_AUDIT_MAX entries (default 50000) and logs what
it removed; AGENTMEMORY_AUDIT_STORE=off still skips the store entirely.

Upstream PR#1176.

Generated-By: Claude Opus 5.5 (1M context)
A trigger word matched mid-sentence dropped the subject and could invert
the lesson; a dot inside a filename cut it short. Lessons are now whole
sentences that open with a trigger, with balanced markup, within 220
chars. A re-import no longer bumps reinforcements or lastReinforcedAt,
so a re-derived lesson can still decay out (rohitg00#1292).

Generated-By: Claude Opus 5.5 (1M context)
OpenAI's reasoning models, including the default gpt-5.6-luna, reject
max_tokens with a 400, so every compress/summarize call failed on a
default config. api.openai.com accepts max_completion_tokens on every
model; compatible servers keep max_tokens (rohitg00#1219).

Generated-By: Claude Opus 5.5 (1M context)
…ault

A memory_smart_search observation contains its query verbatim, so it
outranked the real answer on the next identical search. Unset
AGENTMEMORY_INDEX_EXCLUDE_TOOL_PREFIXES now means both agentmemory MCP
prefixes; set it empty to index everything. Rows stay stored (rohitg00#993).

Generated-By: Claude Opus 5.5 (1M context)
import-jsonl recorded these background jobs as sessions the Operator
never worked in. A transcript whose first prompt is Warmup or the
conversation-list summary instruction is now skipped (rohitg00#1064).

Generated-By: Claude Opus 5.5 (1M context)
At MAX_OBS_PER_SESSION, mem::observe refused every new observation, so
the end of each long session was silently lost; ten live sessions sat
at exactly 500. The cap now evicts the lowest-importance row, oldest
first on a tie, from KV and both indexes, and logs a warning (PR#1174).

Generated-By: Claude Opus 5.5 (1M context)
…branch

Generated-By: Claude Opus 5.5 (1M context)
…e project

An unscoped consolidation run (the 2h timer, session stop) merged the 20
newest summaries from every project into one semantic pass and ran reflect
over all facts, crystals and concepts, so insights mixed repos and carried
no project. It now consolidates each project with summaries newer than the
last unscoped run on its own, and mem::reflect with a project only reads
that project's facts, crystals, lessons and graph concepts. results.semantic
and results.reflect are keyed by project.

Refs rohitg00#1344

Generated-By: Claude Opus 5.5 (1M context)
resolveProject took the basename of --show-toplevel, so every linked
worktree (e.g. orca's <repo>/<fishname>) became its own project and its
Memory never reached the main checkout or sibling worktrees. It now takes
the parent of --git-common-dir when that is a .git folder, falling back to
the toplevel for submodules and bare-repo worktrees. Existing Sessions keep
the project they were filed under.

Refs rohitg00#728

Generated-By: Claude Opus 5.5 (1M context)
Generated-By: Claude Opus 5.5 (1M context)
- Eviction and audit Eviction first run 5 min after boot, then daily, so a
  daemon restarted more often than daily still sweeps.
- Consolidation retries a project whose merge or reflect failed, and a fact
  another project already holds gains this project's Sessions, so scoped
  reflect still sees it.
- Session cap eviction is audited and logs a failed delete; the audit
  retention sweep is named Eviction, per CONTEXT.md.
- A 429 for an exhausted OpenAI quota opens the breaker instead of retrying.
- Summarize skips tokenize only when the character count fits one chunk, so
  dense (CJK) text is still measured.
- Lessons accept a curly apostrophe in "Don't"; reflect no longer swallows a
  failed Session list.
- Restore CRLF on files the branch had converted to LF.
- Triage: rohitg00#969 is already-fixed, not wont-fix; rohitg00#1278 notes part 3 is open.

Generated-By: Claude Opus 5.5 (1M context)
Generated-By: Claude Opus 5.5 (1M context)
@possiblyneal

Copy link
Copy Markdown
Owner Author

Code review: standard scan, with Standards, Spec and Correctness/Logic reviewed.

The fixes are in 585f7f0 and 15eb8fc, and all three reviewers signed off on them. The owner decided to leave the judgement calls as they are.

Reviewed-Head: 15eb8fc

@possiblyneal
possiblyneal merged commit 6ba238d into main Sep 26, 2026
6 checks passed
@possiblyneal
possiblyneal deleted the fix/triage-batch-1 branch October 19, 2026 12:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant