managarten/packages/shared-ai/src/planner
Till JS 72f7978ed4 feat(agent-loop): expose compactionsDone + compactedReminder producer
Closes the loop on M2: when the compactor fires, the LLM needs to know
it's now seeing a <compact-summary> instead of raw turns so it
doesn't waste a turn asking about lost details or re-executing tools
whose responses are gone.

shared-ai:
  - LoopState grows `compactionsDone: number` (cap-1 by current loop
    policy, but shape kept as count for future multi-compact cycles).
  - runPlannerLoop populates it on each reminder-channel call. New
    loop test asserts [0, 1] sequence: round 1 before compaction,
    round 2 after.

mana-ai:
  - New producer `compactedReminder` — fires severity=info when
    compactionsDone >= 1, wrapped in a German one-liner ("frag nicht
    nach verlorenen Details").
  - Injected FIRST in buildReminderChannel so the LLM frames the rest
    of the round with "I'm looking at a summary" context. Metric
    surface stays `{producer='compacted', severity='info'}`.

4 new reminder tests (3 pure producer + 1 composition-ordering) +
1 loop-wiring test. 77 shared-ai, 20 reminders.test.ts — green.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-23 15:36:21 +02:00
..
compact.test.ts feat(shared-ai): compactHistory() — context-window compactor primitive (M2.1) 2026-04-23 15:21:10 +02:00
compact.ts feat(shared-ai): compactHistory() — context-window compactor primitive (M2.1) 2026-04-23 15:21:10 +02:00
index.ts feat(shared-ai): compactHistory() — context-window compactor primitive (M2.1) 2026-04-23 15:21:10 +02:00
loop.test.ts feat(agent-loop): expose compactionsDone + compactedReminder producer 2026-04-23 15:36:21 +02:00
loop.ts feat(agent-loop): expose compactionsDone + compactedReminder producer 2026-04-23 15:36:21 +02:00
mock-llm.ts test(ai): promote MockLlmClient to a shared @mana/shared-ai export 2026-04-20 18:05:46 +02:00
parser.test.ts feat(shared-ai): extract planner + mission types to @mana/shared-ai 2026-04-15 00:01:57 +02:00
parser.ts feat(shared-ai): extract planner + mission types to @mana/shared-ai 2026-04-15 00:01:57 +02:00
prompt.ts chore(ai): P2 batch — prompt sync, perf, dedup, scope unification 2026-04-16 16:33:52 +02:00
system-prompt.ts feat(shared-ai): runPlannerLoop + compact system prompt for function calling 2026-04-20 15:31:01 +02:00
types.ts feat(ai): SSE streaming for foreground Mission Runner 2026-04-16 12:32:43 +02:00