@cortexkit/opencode-magic-context 0.42.6 → 0.43.1
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.
- package/README.md +4 -5
- package/dist/agents/dreamer.d.ts +7 -9
- package/dist/agents/dreamer.d.ts.map +1 -1
- package/dist/agents/hidden-agent-registrations.d.ts.map +1 -1
- package/dist/agents/magic-context-prompt.d.ts.map +1 -1
- package/dist/{announcement-8mgn61fw.js → announcement-1a8bvswd.js} +2 -1
- package/dist/config/index.d.ts +1 -1
- package/dist/config/index.d.ts.map +1 -1
- package/dist/config/live-run-config.d.ts +12 -0
- package/dist/config/live-run-config.d.ts.map +1 -0
- package/dist/config/live-snapshot.d.ts +32 -0
- package/dist/config/live-snapshot.d.ts.map +1 -0
- package/dist/config/schema/magic-context.d.ts +12 -2
- package/dist/config/schema/magic-context.d.ts.map +1 -1
- package/dist/{conflict-warning-hook-aktepwpz.js → conflict-warning-hook-956fkedc.js} +6 -4
- package/dist/{derive-budgets-v1fkhjjr.js → derive-budgets-b8ybssh9.js} +7 -3
- package/dist/features/builtin-commands/commands.d.ts +0 -4
- package/dist/features/builtin-commands/commands.d.ts.map +1 -1
- package/dist/features/magic-context/compaction-marker.d.ts +6 -0
- package/dist/features/magic-context/compaction-marker.d.ts.map +1 -1
- package/dist/features/magic-context/compartment-chunk-embedding.d.ts +4 -1
- package/dist/features/magic-context/compartment-chunk-embedding.d.ts.map +1 -1
- package/dist/features/magic-context/compartment-lease.d.ts +8 -0
- package/dist/features/magic-context/compartment-lease.d.ts.map +1 -1
- package/dist/features/magic-context/compartment-storage.d.ts +21 -0
- package/dist/features/magic-context/compartment-storage.d.ts.map +1 -1
- package/dist/features/magic-context/context-authority.d.ts +9 -2
- package/dist/features/magic-context/context-authority.d.ts.map +1 -1
- package/dist/features/magic-context/dreamer/classify.d.ts.map +1 -1
- package/dist/features/magic-context/dreamer/docs-proposals.d.ts +23 -0
- package/dist/features/magic-context/dreamer/docs-proposals.d.ts.map +1 -0
- package/dist/features/magic-context/dreamer/evaluate-smart-notes.d.ts +5 -1
- package/dist/features/magic-context/dreamer/evaluate-smart-notes.d.ts.map +1 -1
- package/dist/features/magic-context/dreamer/hidden-single-shot.d.ts +51 -0
- package/dist/features/magic-context/dreamer/hidden-single-shot.d.ts.map +1 -0
- package/dist/features/magic-context/dreamer/manual-summary.d.ts +7 -0
- package/dist/features/magic-context/dreamer/manual-summary.d.ts.map +1 -0
- package/dist/features/magic-context/dreamer/map-memories.d.ts +3 -1
- package/dist/features/magic-context/dreamer/map-memories.d.ts.map +1 -1
- package/dist/features/magic-context/dreamer/promote-primers.d.ts +8 -1
- package/dist/features/magic-context/dreamer/promote-primers.d.ts.map +1 -1
- package/dist/features/magic-context/dreamer/refresh-primers.d.ts +3 -1
- package/dist/features/magic-context/dreamer/refresh-primers.d.ts.map +1 -1
- package/dist/features/magic-context/dreamer/retrospective-orphan-sweep.d.ts +5 -2
- package/dist/features/magic-context/dreamer/retrospective-orphan-sweep.d.ts.map +1 -1
- package/dist/features/magic-context/dreamer/retrospective-raw-provider.d.ts +22 -13
- package/dist/features/magic-context/dreamer/retrospective-raw-provider.d.ts.map +1 -1
- package/dist/features/magic-context/dreamer/storage-task-schedule.d.ts +9 -0
- package/dist/features/magic-context/dreamer/storage-task-schedule.d.ts.map +1 -1
- package/dist/features/magic-context/dreamer/task-config.d.ts.map +1 -1
- package/dist/features/magic-context/dreamer/task-executor.d.ts +3 -0
- package/dist/features/magic-context/dreamer/task-executor.d.ts.map +1 -1
- package/dist/features/magic-context/dreamer/task-prompts.d.ts +7 -4
- package/dist/features/magic-context/dreamer/task-prompts.d.ts.map +1 -1
- package/dist/features/magic-context/dreamer/task-registry.d.ts +53 -2
- package/dist/features/magic-context/dreamer/task-registry.d.ts.map +1 -1
- package/dist/features/magic-context/dreamer/task-scheduler.d.ts +3 -0
- package/dist/features/magic-context/dreamer/task-scheduler.d.ts.map +1 -1
- package/dist/features/magic-context/dreamer/tick-failure.d.ts +38 -0
- package/dist/features/magic-context/dreamer/tick-failure.d.ts.map +1 -0
- package/dist/features/magic-context/dreamer/verify.d.ts +4 -1
- package/dist/features/magic-context/dreamer/verify.d.ts.map +1 -1
- package/dist/features/magic-context/git-commits/search-git-commits.d.ts +2 -0
- package/dist/features/magic-context/git-commits/search-git-commits.d.ts.map +1 -1
- package/dist/features/magic-context/memory/embedding-identity.d.ts +1 -0
- package/dist/features/magic-context/memory/embedding-identity.d.ts.map +1 -1
- package/dist/features/magic-context/memory/embedding-local.d.ts.map +1 -1
- package/dist/features/magic-context/memory/memory-diagnostics.d.ts +6 -0
- package/dist/features/magic-context/memory/memory-diagnostics.d.ts.map +1 -0
- package/dist/features/magic-context/memory/memory-selection.d.ts +12 -0
- package/dist/features/magic-context/memory/memory-selection.d.ts.map +1 -0
- package/dist/features/magic-context/memory/memory-visibility.d.ts +46 -0
- package/dist/features/magic-context/memory/memory-visibility.d.ts.map +1 -0
- package/dist/features/magic-context/memory/mirror-reembed.d.ts +22 -0
- package/dist/features/magic-context/memory/mirror-reembed.d.ts.map +1 -0
- package/dist/features/magic-context/memory/project-identity.d.ts +9 -0
- package/dist/features/magic-context/memory/project-identity.d.ts.map +1 -1
- package/dist/features/magic-context/memory/storage-memory-fts.d.ts +6 -2
- package/dist/features/magic-context/memory/storage-memory-fts.d.ts.map +1 -1
- package/dist/features/magic-context/memory/storage-memory.d.ts.map +1 -1
- package/dist/features/magic-context/memory/transformers-remote-host.d.ts +6 -0
- package/dist/features/magic-context/memory/transformers-remote-host.d.ts.map +1 -0
- package/dist/features/magic-context/memory/transformers-web-entry.d.ts.map +1 -1
- package/dist/features/magic-context/memory/verification-paths.d.ts.map +1 -1
- package/dist/features/magic-context/message-fts-rowid-map.d.ts +3 -1
- package/dist/features/magic-context/message-fts-rowid-map.d.ts.map +1 -1
- package/dist/features/magic-context/message-index-async.d.ts +8 -3
- package/dist/features/magic-context/message-index-async.d.ts.map +1 -1
- package/dist/features/magic-context/message-index.d.ts +7 -1
- package/dist/features/magic-context/message-index.d.ts.map +1 -1
- package/dist/features/magic-context/message-time-backfill.d.ts +19 -0
- package/dist/features/magic-context/message-time-backfill.d.ts.map +1 -0
- package/dist/features/magic-context/migrations.d.ts +10 -6
- package/dist/features/magic-context/migrations.d.ts.map +1 -1
- package/dist/features/magic-context/mural/compress-cues.d.ts.map +1 -1
- package/dist/features/magic-context/mural/storage-mural.d.ts +5 -0
- package/dist/features/magic-context/mural/storage-mural.d.ts.map +1 -1
- package/dist/features/magic-context/opencode2-relabel.d.ts +132 -0
- package/dist/features/magic-context/opencode2-relabel.d.ts.map +1 -0
- package/dist/features/magic-context/overflow-detection.d.ts +3 -0
- package/dist/features/magic-context/overflow-detection.d.ts.map +1 -1
- package/dist/features/magic-context/project-embedding-registry.d.ts.map +1 -1
- package/dist/features/magic-context/protection-window.d.ts +1 -1
- package/dist/features/magic-context/protection-window.d.ts.map +1 -1
- package/dist/features/magic-context/search.d.ts +6 -0
- package/dist/features/magic-context/search.d.ts.map +1 -1
- package/dist/features/magic-context/session-decision-calibration.d.ts +31 -0
- package/dist/features/magic-context/session-decision-calibration.d.ts.map +1 -0
- package/dist/features/magic-context/shadow-backfill-state.d.ts +1 -1
- package/dist/features/magic-context/shadow-backfill-state.d.ts.map +1 -1
- package/dist/features/magic-context/smart-notes/compiler.d.ts +5 -1
- package/dist/features/magic-context/smart-notes/compiler.d.ts.map +1 -1
- package/dist/features/magic-context/storage-clone.d.ts.map +1 -1
- package/dist/features/magic-context/storage-db.d.ts +1 -1
- package/dist/features/magic-context/storage-db.d.ts.map +1 -1
- package/dist/features/magic-context/storage-historian-runs.d.ts +4 -2
- package/dist/features/magic-context/storage-historian-runs.d.ts.map +1 -1
- package/dist/features/magic-context/storage-meta-persisted.d.ts +16 -2
- package/dist/features/magic-context/storage-meta-persisted.d.ts.map +1 -1
- package/dist/features/magic-context/storage-meta-shared.d.ts +1 -1
- package/dist/features/magic-context/storage-meta-shared.d.ts.map +1 -1
- package/dist/features/magic-context/storage-meta.d.ts +1 -1
- package/dist/features/magic-context/storage-meta.d.ts.map +1 -1
- package/dist/features/magic-context/storage-notes.d.ts +1 -0
- package/dist/features/magic-context/storage-notes.d.ts.map +1 -1
- package/dist/features/magic-context/storage-replay-document.d.ts +2 -0
- package/dist/features/magic-context/storage-replay-document.d.ts.map +1 -1
- package/dist/features/magic-context/storage-subagent-invocations.d.ts +1 -1
- package/dist/features/magic-context/storage-subagent-invocations.d.ts.map +1 -1
- package/dist/features/magic-context/storage-tags.d.ts +42 -4
- package/dist/features/magic-context/storage-tags.d.ts.map +1 -1
- package/dist/features/magic-context/storage.d.ts +2 -2
- package/dist/features/magic-context/storage.d.ts.map +1 -1
- package/dist/features/magic-context/store-generation-rebase.d.ts +95 -0
- package/dist/features/magic-context/store-generation-rebase.d.ts.map +1 -0
- package/dist/features/magic-context/subagent-token-capture.d.ts +1 -0
- package/dist/features/magic-context/subagent-token-capture.d.ts.map +1 -1
- package/dist/features/magic-context/tagger.d.ts +2 -0
- package/dist/features/magic-context/tagger.d.ts.map +1 -1
- package/dist/features/magic-context/tool-definition-tokens.d.ts +1 -0
- package/dist/features/magic-context/tool-definition-tokens.d.ts.map +1 -1
- package/dist/features/magic-context/tool-owner-backfill.d.ts.map +1 -1
- package/dist/features/magic-context/user-memory/review-user-memories.d.ts +5 -1
- package/dist/features/magic-context/user-memory/review-user-memories.d.ts.map +1 -1
- package/dist/hooks/auto-update-checker/checker.d.ts +1 -0
- package/dist/hooks/auto-update-checker/checker.d.ts.map +1 -1
- package/dist/hooks/magic-context/apply-operations.d.ts +10 -1
- package/dist/hooks/magic-context/apply-operations.d.ts.map +1 -1
- package/dist/hooks/magic-context/cache-busting-signals.d.ts +19 -3
- package/dist/hooks/magic-context/cache-busting-signals.d.ts.map +1 -1
- package/dist/hooks/magic-context/command-handler.d.ts +5 -4
- package/dist/hooks/magic-context/command-handler.d.ts.map +1 -1
- package/dist/hooks/magic-context/compaction-marker-manager.d.ts.map +1 -1
- package/dist/hooks/magic-context/compaction-off-transition.d.ts +1 -0
- package/dist/hooks/magic-context/compaction-off-transition.d.ts.map +1 -1
- package/dist/hooks/magic-context/compartment-prompt.d.ts +1 -1
- package/dist/hooks/magic-context/compartment-prompt.d.ts.map +1 -1
- package/dist/hooks/magic-context/compartment-render-epoch.d.ts +3 -1
- package/dist/hooks/magic-context/compartment-render-epoch.d.ts.map +1 -1
- package/dist/hooks/magic-context/compartment-runner-drop-queue.d.ts +1 -1
- package/dist/hooks/magic-context/compartment-runner-drop-queue.d.ts.map +1 -1
- package/dist/hooks/magic-context/compartment-runner-historian.d.ts +1 -0
- package/dist/hooks/magic-context/compartment-runner-historian.d.ts.map +1 -1
- package/dist/hooks/magic-context/compartment-runner-incremental.d.ts +8 -1
- package/dist/hooks/magic-context/compartment-runner-incremental.d.ts.map +1 -1
- package/dist/hooks/magic-context/compartment-runner-recomp.d.ts.map +1 -1
- package/dist/hooks/magic-context/compartment-runner-types.d.ts +19 -11
- package/dist/hooks/magic-context/compartment-runner-types.d.ts.map +1 -1
- package/dist/hooks/magic-context/compartment-runner-validation.d.ts +4 -1
- package/dist/hooks/magic-context/compartment-runner-validation.d.ts.map +1 -1
- package/dist/hooks/magic-context/compartment-runner.d.ts.map +1 -1
- package/dist/hooks/magic-context/compartment-trigger.d.ts +2 -1
- package/dist/hooks/magic-context/compartment-trigger.d.ts.map +1 -1
- package/dist/hooks/magic-context/decay-render.d.ts +1 -0
- package/dist/hooks/magic-context/decay-render.d.ts.map +1 -1
- package/dist/hooks/magic-context/decision-calibration.d.ts +24 -0
- package/dist/hooks/magic-context/decision-calibration.d.ts.map +1 -0
- package/dist/hooks/magic-context/derive-budgets.d.ts +2 -0
- package/dist/hooks/magic-context/derive-budgets.d.ts.map +1 -1
- package/dist/hooks/magic-context/dropped-input-guard.d.ts +50 -4
- package/dist/hooks/magic-context/dropped-input-guard.d.ts.map +1 -1
- package/dist/hooks/magic-context/embed-history-runner.d.ts +30 -0
- package/dist/hooks/magic-context/embed-history-runner.d.ts.map +1 -0
- package/dist/hooks/magic-context/emergency-drop.d.ts +13 -8
- package/dist/hooks/magic-context/emergency-drop.d.ts.map +1 -1
- package/dist/hooks/magic-context/event-handler.d.ts.map +1 -1
- package/dist/hooks/magic-context/event-payloads.d.ts +2 -1
- package/dist/hooks/magic-context/event-payloads.d.ts.map +1 -1
- package/dist/hooks/magic-context/execute-status.d.ts +2 -1
- package/dist/hooks/magic-context/execute-status.d.ts.map +1 -1
- package/dist/hooks/magic-context/final-wire-token-estimate.d.ts +12 -4
- package/dist/hooks/magic-context/final-wire-token-estimate.d.ts.map +1 -1
- package/dist/hooks/magic-context/heuristic-cleanup.d.ts.map +1 -1
- package/dist/hooks/magic-context/historian-no-fire-cause.d.ts +5 -0
- package/dist/hooks/magic-context/historian-no-fire-cause.d.ts.map +1 -0
- package/dist/hooks/magic-context/historian-publish-stage-logger.d.ts +3 -0
- package/dist/hooks/magic-context/historian-publish-stage-logger.d.ts.map +1 -0
- package/dist/hooks/magic-context/hook-handlers.d.ts +0 -3
- package/dist/hooks/magic-context/hook-handlers.d.ts.map +1 -1
- package/dist/hooks/magic-context/hook.d.ts +4 -4
- package/dist/hooks/magic-context/hook.d.ts.map +1 -1
- package/dist/hooks/magic-context/host-served-rows.d.ts +58 -0
- package/dist/hooks/magic-context/host-served-rows.d.ts.map +1 -0
- package/dist/hooks/magic-context/inject-compartments.d.ts +38 -0
- package/dist/hooks/magic-context/inject-compartments.d.ts.map +1 -1
- package/dist/hooks/magic-context/legacy-compartments.d.ts +20 -0
- package/dist/hooks/magic-context/legacy-compartments.d.ts.map +1 -0
- package/dist/hooks/magic-context/live-session-state.d.ts +7 -7
- package/dist/hooks/magic-context/lkg-slot.d.ts +1 -0
- package/dist/hooks/magic-context/lkg-slot.d.ts.map +1 -1
- package/dist/hooks/magic-context/m0-token-breakdown.d.ts +6 -0
- package/dist/hooks/magic-context/m0-token-breakdown.d.ts.map +1 -1
- package/dist/hooks/magic-context/maintenance-authority.d.ts +0 -1
- package/dist/hooks/magic-context/maintenance-authority.d.ts.map +1 -1
- package/dist/hooks/magic-context/module-state-sync.d.ts +1 -1
- package/dist/hooks/magic-context/module-state-sync.d.ts.map +1 -1
- package/dist/hooks/magic-context/module-transport.d.ts +1 -1
- package/dist/hooks/magic-context/module-transport.d.ts.map +1 -1
- package/dist/hooks/magic-context/module-wire.d.ts +42 -0
- package/dist/hooks/magic-context/module-wire.d.ts.map +1 -1
- package/dist/hooks/magic-context/note-nudger.d.ts.map +1 -1
- package/dist/hooks/magic-context/postprocess-read-cache.d.ts +8 -0
- package/dist/hooks/magic-context/postprocess-read-cache.d.ts.map +1 -0
- package/dist/hooks/magic-context/producer-window-guard.d.ts +16 -0
- package/dist/hooks/magic-context/producer-window-guard.d.ts.map +1 -1
- package/dist/hooks/magic-context/producer-window-test-support.d.ts +14 -0
- package/dist/hooks/magic-context/producer-window-test-support.d.ts.map +1 -0
- package/dist/hooks/magic-context/protected-tail-boundary.d.ts +2 -0
- package/dist/hooks/magic-context/protected-tail-boundary.d.ts.map +1 -1
- package/dist/hooks/magic-context/read-session-chunk.d.ts +45 -10
- package/dist/hooks/magic-context/read-session-chunk.d.ts.map +1 -1
- package/dist/hooks/magic-context/read-session-db.d.ts.map +1 -1
- package/dist/hooks/magic-context/read-session-raw.d.ts +4 -0
- package/dist/hooks/magic-context/read-session-raw.d.ts.map +1 -1
- package/dist/hooks/magic-context/read-session-true-raw-tokens.d.ts +6 -0
- package/dist/hooks/magic-context/read-session-true-raw-tokens.d.ts.map +1 -1
- package/dist/hooks/magic-context/recomp-orchestrator.d.ts +17 -39
- package/dist/hooks/magic-context/recomp-orchestrator.d.ts.map +1 -1
- package/dist/hooks/magic-context/rust-mode-transform.d.ts +26 -3
- package/dist/hooks/magic-context/rust-mode-transform.d.ts.map +1 -1
- package/dist/hooks/magic-context/send-session-notification.d.ts +1 -0
- package/dist/hooks/magic-context/send-session-notification.d.ts.map +1 -1
- package/dist/hooks/magic-context/sentinel.d.ts.map +1 -1
- package/dist/hooks/magic-context/system-prompt-hash.d.ts +6 -7
- package/dist/hooks/magic-context/system-prompt-hash.d.ts.map +1 -1
- package/dist/hooks/magic-context/tag-messages.d.ts +21 -1
- package/dist/hooks/magic-context/tag-messages.d.ts.map +1 -1
- package/dist/hooks/magic-context/tail-hygiene-walk.d.ts +63 -0
- package/dist/hooks/magic-context/tail-hygiene-walk.d.ts.map +1 -1
- package/dist/hooks/magic-context/tokenizer-calibration.d.ts +19 -12
- package/dist/hooks/magic-context/tokenizer-calibration.d.ts.map +1 -1
- package/dist/hooks/magic-context/tool-drop-target.d.ts +52 -1
- package/dist/hooks/magic-context/tool-drop-target.d.ts.map +1 -1
- package/dist/hooks/magic-context/tool-sweep-policy.d.ts +50 -0
- package/dist/hooks/magic-context/tool-sweep-policy.d.ts.map +1 -0
- package/dist/hooks/magic-context/transform-compartment-phase.d.ts +20 -1
- package/dist/hooks/magic-context/transform-compartment-phase.d.ts.map +1 -1
- package/dist/hooks/magic-context/transform-context-state.d.ts +9 -0
- package/dist/hooks/magic-context/transform-context-state.d.ts.map +1 -1
- package/dist/hooks/magic-context/transform-postprocess-phase.d.ts +5 -3
- package/dist/hooks/magic-context/transform-postprocess-phase.d.ts.map +1 -1
- package/dist/hooks/magic-context/transform.d.ts +37 -4
- package/dist/hooks/magic-context/transform.d.ts.map +1 -1
- package/dist/hooks/magic-context/wrapup-orchestrator.d.ts.map +1 -1
- package/dist/{index-f9gem5cr.js → index-0ccmyzbj.js} +90 -10
- package/dist/index-1gtwrdc4.js +393 -0
- package/dist/{index-ntbmt6rq.js → index-4b30nf6z.js} +1 -1
- package/dist/index-6w9p73jz.js +170 -0
- package/dist/{index-4ftb5hcq.js → index-6z9g64js.js} +7 -1
- package/dist/{index-djp6rwz6.js → index-7wpwr2e2.js} +28002 -30125
- package/dist/index-9r1cbh9e.js +16 -0
- package/dist/{safe-notification-target-fepvcbsj.js → index-febg06dy.js} +6 -7
- package/dist/index-j7cnyvq1.js +5409 -0
- package/dist/{index-s61hh7gv.js → index-kpmmr8s0.js} +95 -73
- package/dist/{index-a9ssj59b.js → index-v8qr6tt2.js} +56 -16
- package/dist/{index-qp20p2py.js → index-wgzyeyf5.js} +1 -1
- package/dist/index-y5145x8k.js +619 -0
- package/dist/{index-ngjmj6xx.js → index-yc81txp4.js} +38 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6274 -3180
- package/dist/message-time-backfill-0ccvyk9n.js +109 -0
- package/dist/plugin/dream-timer.d.ts +13 -0
- package/dist/plugin/dream-timer.d.ts.map +1 -1
- package/dist/plugin/hooks/create-session-hooks.d.ts +5 -2
- package/dist/plugin/hooks/create-session-hooks.d.ts.map +1 -1
- package/dist/plugin/memory-id-translation.d.ts +86 -0
- package/dist/plugin/memory-id-translation.d.ts.map +1 -1
- package/dist/plugin/messages-transform.d.ts.map +1 -1
- package/dist/plugin/rpc-handlers.d.ts +10 -0
- package/dist/plugin/rpc-handlers.d.ts.map +1 -1
- package/dist/plugin/rust-note-backend.d.ts +84 -0
- package/dist/plugin/rust-note-backend.d.ts.map +1 -0
- package/dist/plugin/tool-registry.d.ts +1 -0
- package/dist/plugin/tool-registry.d.ts.map +1 -1
- package/dist/read-session-chunk-z7fv0qjv.js +62 -0
- package/dist/recomp-orchestrator-r00aa5t3.js +21 -0
- package/dist/safe-notification-target-vrkjrbgb.js +10 -0
- package/dist/{send-session-notification-jbxknvar.js → send-session-notification-3warjyjp.js} +7 -3
- package/dist/shared/assistant-message-extractor.d.ts +6 -0
- package/dist/shared/assistant-message-extractor.d.ts.map +1 -1
- package/dist/shared/conflict-detector.d.ts +9 -4
- package/dist/shared/conflict-detector.d.ts.map +1 -1
- package/dist/shared/data-path.d.ts.map +1 -1
- package/dist/shared/hidden-variant-warnings.d.ts +5 -0
- package/dist/shared/hidden-variant-warnings.d.ts.map +1 -0
- package/dist/shared/host-limitations.d.ts +14 -0
- package/dist/shared/host-limitations.d.ts.map +1 -0
- package/dist/shared/keep-subagents.d.ts +1 -1
- package/dist/shared/keep-subagents.d.ts.map +1 -1
- package/dist/shared/model-suggestion-retry.d.ts.map +1 -1
- package/dist/shared/models-dev-cache.d.ts +1 -0
- package/dist/shared/models-dev-cache.d.ts.map +1 -1
- package/dist/shared/opencode-config-dir.d.ts +52 -0
- package/dist/shared/opencode-config-dir.d.ts.map +1 -1
- package/dist/shared/opencode-db-path.d.ts +15 -0
- package/dist/shared/opencode-db-path.d.ts.map +1 -1
- package/dist/shared/prompt-surface-runtime.d.ts +5 -5
- package/dist/shared/rpc-server.d.ts +10 -0
- package/dist/shared/rpc-server.d.ts.map +1 -1
- package/dist/shared/rpc-types.d.ts +64 -5
- package/dist/shared/rpc-types.d.ts.map +1 -1
- package/dist/shared/status-detail-text.d.ts +1 -3
- package/dist/shared/status-detail-text.d.ts.map +1 -1
- package/dist/shared/status-summary.d.ts +7 -0
- package/dist/shared/status-summary.d.ts.map +1 -1
- package/dist/shared/status-view.d.ts +229 -0
- package/dist/shared/status-view.d.ts.map +1 -0
- package/dist/shared/tag-transcript.d.ts.map +1 -1
- package/dist/shared/tail-hygiene-status.d.ts +8 -0
- package/dist/shared/tail-hygiene-status.d.ts.map +1 -1
- package/dist/shared/test-temp-dir.d.ts +1 -1
- package/dist/shared/test-temp-dir.d.ts.map +1 -1
- package/dist/shared/user-facing-codes.d.ts +32 -7
- package/dist/shared/user-facing-codes.d.ts.map +1 -1
- package/dist/shared/window-geometry.d.ts +3 -0
- package/dist/shared/window-geometry.d.ts.map +1 -1
- package/dist/{task-config-cv8k9y8r.js → task-config-mgf5nsh3.js} +1 -1
- package/dist/tools/ctx-expand/constants.d.ts +1 -1
- package/dist/tools/ctx-expand/constants.d.ts.map +1 -1
- package/dist/tools/ctx-expand/render.d.ts.map +1 -1
- package/dist/tools/ctx-expand/tools.d.ts.map +1 -1
- package/dist/tools/ctx-memory/constants.d.ts +3 -1
- package/dist/tools/ctx-memory/constants.d.ts.map +1 -1
- package/dist/tools/ctx-memory/tools.d.ts +1 -0
- package/dist/tools/ctx-memory/tools.d.ts.map +1 -1
- package/dist/tools/ctx-memory/types.d.ts +2 -2
- package/dist/tools/ctx-note/constants.d.ts +1 -1
- package/dist/tools/ctx-note/constants.d.ts.map +1 -1
- package/dist/tools/ctx-note/render.d.ts +88 -0
- package/dist/tools/ctx-note/render.d.ts.map +1 -0
- package/dist/tools/ctx-note/tools.d.ts.map +1 -1
- package/dist/tools/ctx-reduce/constants.d.ts +1 -1
- package/dist/tools/ctx-reduce/constants.d.ts.map +1 -1
- package/dist/tools/ctx-search/constants.d.ts +1 -1
- package/dist/tools/ctx-search/constants.d.ts.map +1 -1
- package/dist/tools/ctx-search/date-range.d.ts +9 -0
- package/dist/tools/ctx-search/date-range.d.ts.map +1 -0
- package/dist/tools/ctx-search/tools.d.ts.map +1 -1
- package/dist/tools/ctx-search/types.d.ts +2 -0
- package/dist/tools/ctx-search/types.d.ts.map +1 -1
- package/dist/tools/light-descriptions.d.ts +5 -5
- package/dist/tools/light-descriptions.d.ts.map +1 -1
- package/dist/tools/parameter-descriptions.d.ts +75 -0
- package/dist/tools/parameter-descriptions.d.ts.map +1 -0
- package/dist/transformers-node-wasm.js +1918 -826
- package/dist/transformers-web.js +1736 -636
- package/dist/{transformers.node-dpmf3wpx.js → transformers.node-3zqr6k1w.js} +4087 -2898
- package/dist/tui/data/context-db.d.ts +19 -7
- package/dist/tui/data/context-db.d.ts.map +1 -1
- package/dist/tui-compiled/data/context-db.d.ts +19 -7
- package/dist/tui-compiled/data/context-db.d.ts.map +1 -1
- package/dist/v2/fold/host-media.d.ts +36 -0
- package/dist/v2/fold/host-media.d.ts.map +1 -0
- package/dist/v2/fold/restore.d.ts +21 -1
- package/dist/v2/fold/restore.d.ts.map +1 -1
- package/dist/v2/hidden-completion.d.ts +45 -1
- package/dist/v2/hidden-completion.d.ts.map +1 -1
- package/dist/v2/hooks/commands.d.ts +29 -0
- package/dist/v2/hooks/commands.d.ts.map +1 -0
- package/dist/v2/hooks/context.d.ts +46 -2
- package/dist/v2/hooks/context.d.ts.map +1 -1
- package/dist/v2/hooks/deleted-session-tombstones.d.ts +10 -0
- package/dist/v2/hooks/deleted-session-tombstones.d.ts.map +1 -0
- package/dist/v2/hooks/dream-manual.d.ts +43 -0
- package/dist/v2/hooks/dream-manual.d.ts.map +1 -0
- package/dist/v2/hooks/dream-trigger.d.ts +7 -0
- package/dist/v2/hooks/dream-trigger.d.ts.map +1 -1
- package/dist/v2/hooks/hidden-child.d.ts +7 -0
- package/dist/v2/hooks/hidden-child.d.ts.map +1 -1
- package/dist/v2/hooks/model-limit-cache.d.ts +19 -0
- package/dist/v2/hooks/model-limit-cache.d.ts.map +1 -0
- package/dist/v2/hooks/payload.d.ts.map +1 -1
- package/dist/v2/hooks/provider-admission.d.ts +22 -0
- package/dist/v2/hooks/provider-admission.d.ts.map +1 -0
- package/dist/v2/hooks/rpc-live-state.d.ts +9 -0
- package/dist/v2/hooks/rpc-live-state.d.ts.map +1 -0
- package/dist/v2/hooks/store.d.ts +38 -2
- package/dist/v2/hooks/store.d.ts.map +1 -1
- package/dist/v2/hooks/tools.d.ts +8 -0
- package/dist/v2/hooks/tools.d.ts.map +1 -0
- package/dist/v2/hooks/types.d.ts +59 -0
- package/dist/v2/hooks/types.d.ts.map +1 -1
- package/dist/v2/hooks/usage-reading.d.ts +42 -0
- package/dist/v2/hooks/usage-reading.d.ts.map +1 -0
- package/dist/v2/host-service.d.ts +65 -0
- package/dist/v2/host-service.d.ts.map +1 -0
- package/dist/v2/server.js +142236 -112052
- package/dist/v2/store-reader.d.ts +67 -1
- package/dist/v2/store-reader.d.ts.map +1 -1
- package/dist/v2/tui/events.d.ts +7 -0
- package/dist/v2/tui/events.d.ts.map +1 -0
- package/dist/v2/tui/index.d.ts +23 -0
- package/dist/v2/tui/index.d.ts.map +1 -1
- package/dist/v2/tui/sidebar-mount.d.ts +40 -0
- package/dist/v2/tui/sidebar-mount.d.ts.map +1 -0
- package/dist/v2/tui/status-dialog-mount.d.ts +29 -0
- package/dist/v2/tui/status-dialog-mount.d.ts.map +1 -0
- package/dist/v2/tui/types.d.ts +74 -6
- package/dist/v2/tui/types.d.ts.map +1 -1
- package/dist/wrapup-orchestrator-y0bs7t5a.js +18 -0
- package/package.json +9 -7
- package/src/agents/dreamer.ts +7 -16
- package/src/agents/hidden-agent-registrations.ts +10 -22
- package/src/agents/magic-context-prompt.test.ts +29 -39
- package/src/agents/magic-context-prompt.ts +99 -122
- package/src/agents/permissions.test.ts +17 -21
- package/src/config/index.ts +8 -3
- package/src/config/live-run-config.test.ts +237 -0
- package/src/config/live-run-config.ts +80 -0
- package/src/config/live-schema-drift.test.ts +67 -0
- package/src/config/live-snapshot.test.ts +85 -0
- package/src/config/live-snapshot.ts +191 -0
- package/src/config/raw-loader.test.ts +1 -0
- package/src/config/schema/magic-context.test.ts +13 -5
- package/src/config/schema/magic-context.ts +101 -10
- package/src/features/magic-context/dreamer/task-registry.ts +137 -13
- package/src/shared/assistant-message-extractor.test.ts +21 -0
- package/src/shared/assistant-message-extractor.ts +43 -8
- package/src/shared/child-session-teardown.test.ts +38 -3
- package/src/shared/child-session-teardown.ts +3 -3
- package/src/shared/conflict-detector.test.ts +224 -7
- package/src/shared/conflict-detector.ts +161 -89
- package/src/shared/data-path.ts +6 -6
- package/src/shared/hidden-variant-warnings.ts +21 -0
- package/src/shared/host-limitations.ts +43 -0
- package/src/shared/keep-subagents.ts +6 -6
- package/src/shared/model-suggestion-retry.test.ts +86 -0
- package/src/shared/model-suggestion-retry.ts +29 -0
- package/src/shared/models-dev-cache.ts +5 -0
- package/src/shared/opencode-config-dir.ts +80 -7
- package/src/shared/opencode-db-path.test.ts +78 -0
- package/src/shared/opencode-db-path.ts +49 -2
- package/src/shared/opencode-host-generation.test.ts +29 -0
- package/src/shared/prompt-surface-a1-golden.md +142 -211
- package/src/shared/rpc-server.ts +18 -0
- package/src/shared/rpc-types.ts +63 -4
- package/src/shared/status-detail-text.test.ts +52 -18
- package/src/shared/status-detail-text.ts +1 -90
- package/src/shared/status-summary.ts +37 -2
- package/src/shared/status-view.test.ts +441 -0
- package/src/shared/status-view.ts +707 -0
- package/src/shared/tag-transcript.ts +115 -16
- package/src/shared/tail-hygiene-status.ts +9 -1
- package/src/shared/test-temp-dir.ts +3 -0
- package/src/shared/user-facing-codes.test.ts +3 -4
- package/src/shared/user-facing-codes.ts +33 -8
- package/src/shared/window-geometry.test.ts +23 -5
- package/src/shared/window-geometry.ts +13 -3
- package/src/tui/data/context-db.ts +50 -15
- package/src/tui/dialogs/status-dialog-colors.test.ts +58 -0
- package/src/tui/dialogs/status-dialog.tsx +288 -0
- package/src/tui/index.tsx +7 -464
- package/src/tui/slots/sidebar-content.tsx +21 -5
- package/src/tui-compiled/data/context-db.ts +50 -15
- package/src/tui-compiled/dialogs/status-dialog.tsx +552 -0
- package/src/tui-compiled/index.tsx +43 -1025
- package/src/tui-compiled/slots/sidebar-content.tsx +173 -152
- package/src/v2/tui/__fixtures__/ga-host-theme.json +160 -0
- package/src/v2/tui/events.ts +23 -0
- package/src/v2/tui/host-contract.test.ts +57 -8
- package/src/v2/tui/index.ts +315 -59
- package/src/v2/tui/load-compiled-sidebar.d.mts +59 -0
- package/src/v2/tui/load-compiled-sidebar.mjs +24 -0
- package/src/v2/tui/load-compiled-status-dialog.d.mts +17 -0
- package/src/v2/tui/load-compiled-status-dialog.mjs +16 -0
- package/src/v2/tui/sidebar-fallback.test.ts +100 -0
- package/src/v2/tui/sidebar-mount.ts +164 -0
- package/src/v2/tui/sidebar-text.test.ts +70 -0
- package/src/v2/tui/status-dialog-fallback.test.ts +97 -0
- package/src/v2/tui/status-dialog-mount.ts +76 -0
- package/src/v2/tui/theme-mapping.test.ts +57 -0
- package/src/v2/tui/types.ts +69 -4
- package/tui.js +1 -0
- package/dist/features/magic-context/memory/memory-migration.d.ts +0 -129
- package/dist/features/magic-context/memory/memory-migration.d.ts.map +0 -1
- package/dist/hooks/magic-context/upgrade-reminder.d.ts +0 -76
- package/dist/hooks/magic-context/upgrade-reminder.d.ts.map +0 -1
- package/dist/index-4wwr6cz0.js +0 -112
- package/dist/index-avwt563y.js +0 -62
- package/dist/index-znraa0kv.js +0 -637
- package/dist/recomp-orchestrator-0xx1364v.js +0 -19
- package/dist/storage-meta-session-z818pn1e.js +0 -20
|
@@ -26,8 +26,8 @@ describe("buildMagicContextSection — generic guidance", () => {
|
|
|
26
26
|
it("does not emit legacy agent-tailored guidance", () => {
|
|
27
27
|
const out = buildMagicContextSection("atlas", 20, true, false, false, false);
|
|
28
28
|
|
|
29
|
-
expect(out).toContain("###
|
|
30
|
-
expect(out).toContain("
|
|
29
|
+
expect(out).toContain("### Your desk");
|
|
30
|
+
expect(out).toContain("no longer needs to stay on the desk for the work ahead");
|
|
31
31
|
expect(out).not.toContain("CRITICAL — you run long sessions");
|
|
32
32
|
expect(out).not.toContain("delegation tool outputs from completed waves");
|
|
33
33
|
expect(out).not.toContain("council member response outputs");
|
|
@@ -79,9 +79,10 @@ describe("buildMagicContextSection — subagent mode", () => {
|
|
|
79
79
|
const out = subagent();
|
|
80
80
|
// Has the marker (injection idempotency) + the tag/ctx_reduce mechanics.
|
|
81
81
|
expect(out).toContain("## Magic Context");
|
|
82
|
-
expect(out).toContain("
|
|
82
|
+
expect(out).toContain("Your context is a desk");
|
|
83
|
+
expect(out).toContain("§N§ tag");
|
|
83
84
|
expect(out).toContain("ctx_reduce");
|
|
84
|
-
expect(out).toContain("newest
|
|
85
|
+
expect(out).toContain("newest tags are protected");
|
|
85
86
|
});
|
|
86
87
|
|
|
87
88
|
it("OMITS the long-term-partner frame and primary-only guidance", () => {
|
|
@@ -99,7 +100,7 @@ describe("buildMagicContextSection — subagent mode", () => {
|
|
|
99
100
|
const withSeven = buildMagicContextSection(null, 7, true, false, false, false, true);
|
|
100
101
|
const withTwenty = buildMagicContextSection(null, 20, true, false, false, false, true);
|
|
101
102
|
expect(withSeven).toBe(withTwenty);
|
|
102
|
-
expect(withSeven).toContain("newest
|
|
103
|
+
expect(withSeven).toContain("newest tags are protected");
|
|
103
104
|
});
|
|
104
105
|
|
|
105
106
|
it("is much shorter than the full primary block", () => {
|
|
@@ -132,8 +133,8 @@ describe("buildMagicContextSection: memory gating", () => {
|
|
|
132
133
|
true,
|
|
133
134
|
);
|
|
134
135
|
expect(memOn).toBe(legacy);
|
|
135
|
-
expect(memOn).toContain("
|
|
136
|
-
expect(memOn).toContain("
|
|
136
|
+
expect(memOn).toContain("`<project-memory>` is the pinboard");
|
|
137
|
+
expect(memOn).toContain("`ctx_memory` pins a new one");
|
|
137
138
|
});
|
|
138
139
|
|
|
139
140
|
it("memory OFF drops ALL ctx_memory guidance but keeps ctx_search", () => {
|
|
@@ -149,10 +150,8 @@ describe("buildMagicContextSection: memory gating", () => {
|
|
|
149
150
|
false,
|
|
150
151
|
);
|
|
151
152
|
expect(off).not.toContain("ctx_memory");
|
|
152
|
-
expect(off).not.toContain("
|
|
153
|
-
expect(off).toContain("
|
|
154
|
-
// no dangling blank line where the block was removed
|
|
155
|
-
expect(off).not.toContain("\n\nUse `ctx_search`");
|
|
153
|
+
expect(off).not.toContain("pinboard");
|
|
154
|
+
expect(off).toContain("`ctx_search` searches the archive");
|
|
156
155
|
});
|
|
157
156
|
|
|
158
157
|
it("memory OFF gates the guidance in no-reduce mode too", () => {
|
|
@@ -168,7 +167,7 @@ describe("buildMagicContextSection: memory gating", () => {
|
|
|
168
167
|
false,
|
|
169
168
|
);
|
|
170
169
|
expect(off).not.toContain("ctx_memory");
|
|
171
|
-
expect(off).toContain("
|
|
170
|
+
expect(off).toContain("`ctx_search` searches the archive");
|
|
172
171
|
});
|
|
173
172
|
});
|
|
174
173
|
|
|
@@ -247,15 +246,8 @@ describe("buildMagicContextSection — compaction-off guidance variant (#266 S4)
|
|
|
247
246
|
const out = buildMagicContextSection(null, 20, false, false, false, false);
|
|
248
247
|
// No ctx_reduce tool mention.
|
|
249
248
|
expect(out).not.toContain("ctx_reduce");
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
// identifiers" — that advertising line is absent here. (The
|
|
253
|
-
// `[dropped §N§]` sentinel appears only inside TOOL_HISTORY_GUIDANCE's
|
|
254
|
-
// "never reproduce these markers" prohibition list, which is shared
|
|
255
|
-
// by both variants and is not advertising; the spec pins reuse of the
|
|
256
|
-
// existing variant byte-identical, so that prohibition mention stays.)
|
|
257
|
-
expect(out).not.toContain("tagged with §N§ identifiers");
|
|
258
|
-
expect(out).not.toContain("Use `ctx_reduce`");
|
|
249
|
+
expect(out).not.toContain("§N§");
|
|
250
|
+
expect(out).not.toContain("ctx_reduce");
|
|
259
251
|
// No tag-based-recovery WORKFLOW wording. The expand line frames
|
|
260
252
|
// recovery around <session-history> summary headings and ctx_search
|
|
261
253
|
// message ordinals, not §N§ tags. "tag" appears only inside the
|
|
@@ -275,11 +267,9 @@ describe("buildMagicContextSection — compaction-off guidance variant (#266 S4)
|
|
|
275
267
|
|
|
276
268
|
it("frames ctx_expand as recovery for summaries / ctx_search hits, not tag-based recovery", () => {
|
|
277
269
|
const out = buildMagicContextSection(null, 20, false, false, false, false);
|
|
278
|
-
|
|
279
|
-
// summary headings and ctx_search message ordinals — not §N§ tags.
|
|
280
|
-
expect(out).toContain("ctx_expand");
|
|
270
|
+
expect(out).toContain("ctx_expand(start, end)");
|
|
281
271
|
expect(out).toContain("session-history");
|
|
282
|
-
expect(out).toContain("
|
|
272
|
+
expect(out).toContain("heading is a pointer into the archive");
|
|
283
273
|
});
|
|
284
274
|
|
|
285
275
|
it("the reduce variant DOES advertise §N§ and ctx_reduce (contrast for the off-mode assertion)", () => {
|
|
@@ -289,7 +279,7 @@ describe("buildMagicContextSection — compaction-off guidance variant (#266 S4)
|
|
|
289
279
|
// still pass but the off-mode assertion above would go red.
|
|
290
280
|
const reduce = buildMagicContextSection(null, 20, true, false, false, false);
|
|
291
281
|
expect(reduce).toContain("ctx_reduce");
|
|
292
|
-
expect(reduce).toContain("
|
|
282
|
+
expect(reduce).toContain("arrives with a §N§ tag");
|
|
293
283
|
});
|
|
294
284
|
});
|
|
295
285
|
|
|
@@ -333,8 +323,8 @@ describe("buildMagicContextSection — prompt-surface composition", () => {
|
|
|
333
323
|
|
|
334
324
|
expect(explicitFull).toBe(implicit);
|
|
335
325
|
expect(light).not.toBe(implicit);
|
|
336
|
-
expect(light).toContain("
|
|
337
|
-
expect(light).toContain("
|
|
326
|
+
expect(light).toContain("### Your desk");
|
|
327
|
+
expect(light).toContain("Stamp as soon as an item has served its purpose, silently");
|
|
338
328
|
expect(light).toContain("DO NOT mimic this style");
|
|
339
329
|
expect(light).toContain("Keep code, identifiers, file paths");
|
|
340
330
|
expect(light).not.toContain("### Reduction Triggers");
|
|
@@ -364,26 +354,26 @@ describe("buildMagicContextSection — prompt-surface composition", () => {
|
|
|
364
354
|
);
|
|
365
355
|
|
|
366
356
|
const memoryOff = light({ memory: false });
|
|
367
|
-
expect(memoryOff).not.toContain("
|
|
357
|
+
expect(memoryOff).not.toContain("`ctx_memory` pins");
|
|
368
358
|
expect(memoryOff).toContain("ctx_search");
|
|
369
359
|
|
|
370
360
|
const noReduce = light({ reduce: false });
|
|
371
|
-
expect(noReduce).not.toContain("
|
|
372
|
-
expect(noReduce).not.toContain("
|
|
361
|
+
expect(noReduce).not.toContain("§N§");
|
|
362
|
+
expect(noReduce.slice(noReduce.indexOf("### Your desk"))).not.toContain("ctx_reduce");
|
|
373
363
|
|
|
374
364
|
const gatedOff = light({ dreamer: false, temporal: false, caveman: false });
|
|
375
|
-
expect(gatedOff).not.toContain("surface_condition
|
|
376
|
-
expect(gatedOff).not.toContain("
|
|
365
|
+
expect(gatedOff).not.toContain("a `surface_condition` leaves the note");
|
|
366
|
+
expect(gatedOff).not.toContain("<!-- +Xm -->");
|
|
377
367
|
expect(gatedOff).not.toContain("**BEWARE**");
|
|
378
368
|
|
|
379
369
|
const gatedOn = light({ dreamer: true, temporal: true, caveman: true, language: "tr" });
|
|
380
|
-
expect(gatedOn).toContain("surface_condition
|
|
381
|
-
expect(gatedOn).toContain("
|
|
370
|
+
expect(gatedOn).toContain("a `surface_condition` leaves the note");
|
|
371
|
+
expect(gatedOn).toContain("<!-- +Xm -->");
|
|
382
372
|
expect(gatedOn).toContain("**BEWARE**");
|
|
383
373
|
expect(gatedOn).toContain("Keep code, identifiers, file paths");
|
|
384
374
|
|
|
385
375
|
const subagent = light({ subagent: true });
|
|
386
|
-
expect(subagent).toContain("
|
|
376
|
+
expect(subagent).toContain("Your context is a desk");
|
|
387
377
|
expect(subagent).toContain("[dropped §N§]");
|
|
388
378
|
expect(subagent).not.toContain("long-term partner");
|
|
389
379
|
expect(subagent).not.toContain("ctx_search");
|
|
@@ -407,10 +397,10 @@ describe("buildMagicContextSection — prompt-surface composition", () => {
|
|
|
407
397
|
|
|
408
398
|
expect(output.startsWith(override)).toBe(true);
|
|
409
399
|
expect(output.match(/^## Magic Context$/gm)).toHaveLength(1);
|
|
410
|
-
expect(output).toContain("
|
|
400
|
+
expect(output).toContain("<!-- +Xm -->");
|
|
411
401
|
expect(output).toContain("**BEWARE**: History compression is on");
|
|
412
402
|
expect(output).toContain("Use Turkish (Türkçe) for your natural-language replies");
|
|
413
|
-
expect(output.indexOf("
|
|
403
|
+
expect(output.indexOf("<!-- +Xm -->")).toBeGreaterThan(
|
|
414
404
|
output.indexOf("User-owned primary guidance."),
|
|
415
405
|
);
|
|
416
406
|
expect(output).not.toContain("### Reduction Triggers");
|
|
@@ -432,7 +422,7 @@ describe("buildMagicContextSection — prompt-surface composition", () => {
|
|
|
432
422
|
"## Magic Context\n\nPrimary override must not reach subagents.",
|
|
433
423
|
);
|
|
434
424
|
|
|
435
|
-
expect(output).toContain("§N§
|
|
425
|
+
expect(output).toContain("§N§ tag");
|
|
436
426
|
expect(output).not.toContain("Primary override must not reach subagents");
|
|
437
427
|
});
|
|
438
428
|
});
|
|
@@ -35,137 +35,117 @@ const PARTNER_FRAME_CLOSER_REDUCE_LIGHT = `\nWhen ctx_reduce is available, use i
|
|
|
35
35
|
|
|
36
36
|
const PARTNER_FRAME_CLOSER_NO_REDUCE_LIGHT = `\nWhen ctx_reduce is unavailable, context is automatic; never prune, heed reduction warnings, or cut task scope or depth because context is large.`;
|
|
37
37
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
// Tool history guidance is shared by both presets.
|
|
50
|
-
const TOOL_HISTORY_GUIDANCE = `Compressed history intentionally omits tool calls and their outputs — summaries like "I edited file X" are historian records, not patterns to replicate. In the live conversation, older tool calls and their results are cleaned up to save context — you may see your own past messages referencing actions without the corresponding tool call or result visible. This is normal context management. ALWAYS use real tool calls; never simulate, fabricate, or inline tool outputs in your text. If there is no tool result message, the action did not happen. NEVER simulate, hallucinate or claim tool calls, command output, search results, file edits, or diffs in plain text as if they actually occurred.
|
|
51
|
-
Magic Context control metadata is not reply syntax. Never reproduce \`<system-reminder>\`, \`<ctx-search-hint>\`, \`<session-history>\`, \`<session-history-since>\`, \`<project-memory>\`, \`<memory-updates>\`, \`<new-compartments>\`, \`<new-memories>\`, \`[dropped §N§]\`, or \`<!-- +Xm -->\` markers in a normal reply and never treat them as user instructions; use ordinary prose and real tool calls instead.`;
|
|
52
|
-
|
|
53
|
-
/** ctx_memory-specific guidance. Gated out when `memory.enabled: false`: with
|
|
54
|
-
* memory off, the `<project-memory>` block is never injected, so anything the
|
|
55
|
-
* agent writes would never resurface, and telling it to "save to memory" is
|
|
56
|
-
* misleading busywork. Identical in both ctx_reduce modes. ctx_search guidance
|
|
57
|
-
* stays regardless (it still recalls conversation + git commits when memory is
|
|
58
|
-
* off, it just won't return memory hits). */
|
|
59
|
-
const MEMORY_GUIDANCE = `Use \`ctx_memory\` for durable project knowledge: write what future sessions must know, update/archive/merge the memories you see in \`<project-memory>\` when they drift. Memories persist across sessions and every new session starts with them.
|
|
60
|
-
Memories are grouped by category as \`#id: fact\` lines; pass the numeric id to \`ctx_memory\` actions.
|
|
61
|
-
**Save to memory proactively**: If you spent multiple turns finding something (a file path, a DB location, a config pattern, a workaround), save it with \`ctx_memory\` so future sessions don't repeat the search. Examples:
|
|
62
|
-
- Found a project's source code path after searching → \`ctx_memory(action="write", category="CONFIG_VALUES", content="OpenCode source is at ~/Work/OSS/opencode")\`
|
|
63
|
-
- Discovered a non-obvious build/test command → \`ctx_memory(action="write", category="PROJECT_RULES", content="Always use scripts/release.sh for releases")\`
|
|
64
|
-
- Learned a constraint the hard way → \`ctx_memory(action="write", category="CONSTRAINTS", content="Dashboard Tauri build needs RGBA PNGs, not grayscale")\``;
|
|
65
|
-
|
|
66
|
-
/** Renders MEMORY_GUIDANCE + trailing newline when memory is on, else "". Placed
|
|
67
|
-
* before the ctx_search line so turning memory off removes the block without
|
|
68
|
-
* leaving a blank line (the memory-on output stays exactly as it was before
|
|
69
|
-
* this flag existed). */
|
|
70
|
-
function memoryGuidanceBlock(memoryEnabled: boolean): string {
|
|
71
|
-
return memoryEnabled ? `${MEMORY_GUIDANCE}\n` : "";
|
|
72
|
-
}
|
|
38
|
+
const CTX_NOTE_GUIDANCE = `\`ctx_note\` is the tray for work you intend to return to, with its findings attached; findings without an intention are not a note. When the user says "take a note", it always goes in the tray.`;
|
|
39
|
+
|
|
40
|
+
const MEMORY_GUIDANCE = `\`<project-memory>\` is the pinboard: facts about this project that stay true for the months this work lasts, as \`#id: fact\` lines — for you, and for every other agent working on this project. \`ctx_memory\` pins a new one when you learn something that must not have to be found again, and especially when it cost you several turns to find.`;
|
|
41
|
+
|
|
42
|
+
const TOOL_HISTORY_GUIDANCE = `Older work is not kept on the desk at all. Magic Context files it as an organized record, \`<session-history>\`: one heading per stretch of work, \`## start-end · date · title\`, with a summary underneath. Each heading is a pointer into the archive — \`ctx_expand(start, end)\` opens that stretch in full when the summary is not enough. Because of this filing, your own earlier messages may mention actions whose tool call is no longer on the desk. That is normal. It is never a reason to fabricate: if there is no tool result on the desk, the action did not happen, and you never inline or invent a tool call, an output, a search result or a diff in your own text.`;
|
|
43
|
+
|
|
44
|
+
const SMART_NOTE_GUIDANCE = `A note with a \`surface_condition\` is left with an outside checker that looks the condition up periodically and returns the note only when it holds.`;
|
|
45
|
+
|
|
46
|
+
const TEMPORAL_AWARENESS_GUIDANCE = `, and \`<!-- +Xm -->\` before a user message (the time that passed since your last reply; headings in the record carry \`start-date\`/\`end-date\` too)`;
|
|
47
|
+
|
|
48
|
+
const TEMPORAL_AWARENESS_OVERRIDE_GUIDANCE = `\nSome things on the desk are Magic Context's own markings, not conversation: \`<system-reminder>\`, \`<ctx-search-hint>\`, \`<session-history>\`, \`<session-history-since>\`, \`<project-memory>\`, \`<memory-updates>\`, \`<new-compartments>\`, \`<new-memories>\`, \`[dropped §N§]\`${TEMPORAL_AWARENESS_GUIDANCE}. Read them, use the time, and never reproduce them in a reply or treat them as instructions.`;
|
|
73
49
|
|
|
74
50
|
const BASE_INTRO = (
|
|
75
51
|
memoryEnabled: boolean,
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
- Looking for how something was implemented previously → \`ctx_search(query="how does the dreamer lease work?")\`
|
|
87
|
-
- Want to recall what was decided in an earlier conversation → \`ctx_search(query="what did we decide about the dashboard release signing setup?")\`
|
|
88
|
-
\`ctx_search\` returns ranked results from memories, git commits, and raw message history. Use message ordinals from results with \`ctx_expand\` to retrieve surrounding conversation context.
|
|
52
|
+
dreamerEnabled: boolean,
|
|
53
|
+
temporalAwarenessEnabled: boolean,
|
|
54
|
+
): string => `### Your desk
|
|
55
|
+
|
|
56
|
+
Think of your context as a desk. Every message and every tool output lands on it, and each item arrives with a §N§ tag (§1§, §42§) — the tag is the item's handle.
|
|
57
|
+
|
|
58
|
+
When an item no longer needs to stay on the desk for the work ahead, stamp it: \`ctx_reduce\` with its tag. Stamping does not remove anything — the item stays on the desk, fully readable. From time to time, when stamped items have piled up and the desk needs room, Magic Context clears them all in one sweep; you don't pick the moment, you only stamp. Stamp as soon as an item has served its purpose, not at the end of the turn, and do it silently: nobody wants to read "I'll drop these outputs". Never stamp a user message for what it asks of you; a large paste inside one is fine once you have used it.
|
|
59
|
+
|
|
60
|
+
Nothing stamped is ever lost. A cleared item goes to the archive — a recent one leaves a \`[dropped §N§]\` placeholder on the desk, an older one leaves nothing — and \`ctx_expand(message=N)\` brings it back whole: text, tool input, tool output. Now and then Magic Context leaves a short reminder on the desk saying how much unstamped material is lying around; that is housekeeping, not a warning, and the desk never gets smaller for it.
|
|
61
|
+
|
|
89
62
|
${TOOL_HISTORY_GUIDANCE}
|
|
90
|
-
NEVER drop large ranges blindly (e.g., "1-50"). Review each tag before deciding.
|
|
91
|
-
Keep your user's instructions and intent — never drop a user message for its directive, even an old one. But a large block of pasted content inside a user message (logs, data dumps, long code, attachments) is fair to mark discardable once you've extracted what you need — it stays searchable via \`ctx_search\`.
|
|
92
|
-
NEVER drop assistant text messages unless they are exceptionally large. Your conversation messages are lightweight; only large tool outputs are worth dropping.
|
|
93
|
-
Before your turn finishes, consider using \`ctx_reduce\` to drop large tool outputs you no longer need.`;
|
|
94
|
-
|
|
95
|
-
/** Intro when ctx_reduce is unavailable — no drop guidance, no ctx_reduce
|
|
96
|
-
* references, and no tag system description. When the session's tool allow-list
|
|
97
|
-
* denies ctx_reduce, transform.ts skips §N§ prefix injection entirely, so the
|
|
98
|
-
* agent never sees tags — describing a tagging system they can't observe just
|
|
99
|
-
* wastes tokens and (empirically) primes some models to emit malformed `§N">§`
|
|
100
|
-
* tokens at the start of their own text. */
|
|
101
|
-
const BASE_INTRO_NO_REDUCE = (memoryEnabled: boolean): string => `${CTX_NOTE_GUIDANCE}
|
|
102
|
-
${memoryGuidanceBlock(memoryEnabled)}Use \`ctx_search\` to search across project memories, indexed git commits, and this session's full conversation history (including compacted parts) from one query.
|
|
103
|
-
Use \`ctx_expand\` to recover the raw conversation behind a summary under a \`## start-end · date · title\` heading inside \`<session-history>\` — pass the heading's start/end range when the summary is not enough (exact wording, values, error text).
|
|
104
|
-
**Search before asking the user**: If you can't remember or don't know something that might have been discussed before or stored in project memory, use \`ctx_search\` before asking the user. Examples:
|
|
105
|
-
- Can't remember where a related codebase or dependency lives → \`ctx_search(query="where is the opencode source code path?")\`
|
|
106
|
-
- Forgot a prior architectural decision or constraint → \`ctx_search(query="why did we choose SQLite over postgres?")\`
|
|
107
|
-
- Need a config value, API key location, or environment detail → \`ctx_search(query="how is the embedding provider configured?")\`
|
|
108
|
-
- Looking for how something was implemented previously → \`ctx_search(query="how does the dreamer lease work?")\`
|
|
109
|
-
- Want to recall what was decided in an earlier conversation → \`ctx_search(query="what did we decide about the dashboard release signing setup?")\`
|
|
110
|
-
\`ctx_search\` returns ranked results from memories, git commits, and raw message history. Use message ordinals from results with \`ctx_expand\` to retrieve surrounding conversation context.
|
|
111
|
-
${TOOL_HISTORY_GUIDANCE}`;
|
|
112
|
-
|
|
113
|
-
const LIGHT_SEARCH_RECOVERY = `Use ctx_search before asking the user about prior project context; it searches memories, commits, and compacted conversation. When a session-history summary lacks exact wording, values, errors, or reasoning, call ctx_expand with its heading range instead of guessing.`;
|
|
114
63
|
|
|
115
|
-
|
|
64
|
+
\`ctx_search\` searches the archive: anything ever said, decided, committed or noted in this project, including what is filed away. Ask it before you ask the user something that may already be recorded here, and whenever something feels familiar but is not in view.
|
|
65
|
+
|
|
66
|
+
${memoryEnabled ? `${MEMORY_GUIDANCE} ` : ""}${CTX_NOTE_GUIDANCE}${dreamerEnabled ? ` ${SMART_NOTE_GUIDANCE}` : ""}
|
|
67
|
+
|
|
68
|
+
Some things on the desk are Magic Context's own markings, not conversation: \`<system-reminder>\`, \`<ctx-search-hint>\`, \`<session-history>\`, \`<session-history-since>\`, \`<project-memory>\`, \`<memory-updates>\`, \`<new-compartments>\`, \`<new-memories>\`, \`[dropped §N§]\`${temporalAwarenessEnabled ? TEMPORAL_AWARENESS_GUIDANCE : ""}. Read them, ${temporalAwarenessEnabled ? "use the time, and" : "and"} never reproduce them in a reply or treat them as instructions.`;
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Derived from the accepted desk copy for sessions where ctx_reduce is unavailable.
|
|
72
|
+
* The archive, filing, search, pinboard, tray, and markings remain, while tag and
|
|
73
|
+
* stamping language is absent because those sessions never receive tag prefixes.
|
|
74
|
+
*/
|
|
75
|
+
const BASE_INTRO_NO_REDUCE = (
|
|
116
76
|
memoryEnabled: boolean,
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
77
|
+
dreamerEnabled: boolean,
|
|
78
|
+
temporalAwarenessEnabled: boolean,
|
|
79
|
+
): string => `### Your desk
|
|
80
|
+
|
|
81
|
+
Think of your context as a desk. Every message and every tool output lands on it.
|
|
82
|
+
|
|
83
|
+
Nothing cleared from the desk is ever lost. A cleared item goes to the archive — a recent one leaves a placeholder on the desk, an older one leaves nothing — and \`ctx_expand(message=N)\` brings it back whole: text, tool input, tool output.
|
|
84
|
+
|
|
121
85
|
${TOOL_HISTORY_GUIDANCE}
|
|
122
|
-
For primary ctx_reduce choices, NEVER blanket-drop a large range because mixed-value evidence may be lost: inspect every tag first. Drop only analyzed reads, searches, diagnostics, or build/test outputs after use. NEVER drop user directives or assistant prose unless exceptionally large; keep requirements, constraints, unresolved errors or decisions, exact wording, raw evidence, and active files or work. Only extracted pasted user payloads may go.
|
|
123
|
-
Consider small targeted drops after acted-on reads or searches, completed logical steps, before context switches, and before the turn ends; this keeps the working set tidy without changing task scope.`;
|
|
124
86
|
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
${
|
|
87
|
+
\`ctx_search\` searches the archive: anything ever said, decided, committed or noted in this project, including what is filed away. Ask it before you ask the user something that may already be recorded here, and whenever something feels familiar but is not in view.
|
|
88
|
+
|
|
89
|
+
${memoryEnabled ? `${MEMORY_GUIDANCE} ` : ""}${CTX_NOTE_GUIDANCE}${dreamerEnabled ? ` ${SMART_NOTE_GUIDANCE}` : ""}
|
|
90
|
+
|
|
91
|
+
Some things on the desk are Magic Context's own markings, not conversation: \`<system-reminder>\`, \`<ctx-search-hint>\`, \`<session-history>\`, \`<session-history-since>\`, \`<project-memory>\`, \`<memory-updates>\`, \`<new-compartments>\`, \`<new-memories>\`${temporalAwarenessEnabled ? TEMPORAL_AWARENESS_GUIDANCE : ""}. Read them, ${temporalAwarenessEnabled ? "use the time, and" : "and"} never reproduce them in a reply or treat them as instructions.`;
|
|
92
|
+
|
|
93
|
+
const CTX_NOTE_GUIDANCE_LIGHT = `\`ctx_note\` is the tray for work you intend to return to, with its findings attached; findings without an intention are not a note; "take a note" from the user always goes there`;
|
|
94
|
+
|
|
95
|
+
const MEMORY_GUIDANCE_LIGHT = `\`<project-memory>\` is the pinboard of facts that stay true for the months this work lasts (\`#id: fact\`), for you and every agent on the project; \`ctx_memory\` pins what must not have to be found again, especially what cost you turns.`;
|
|
96
|
+
|
|
97
|
+
const TOOL_HISTORY_GUIDANCE_LIGHT = `Older work is filed off the desk into \`<session-history>\` — one \`## start-end · date · title\` heading per stretch, a summary under each, \`ctx_expand(start, end)\` to open the stretch in full. So your earlier messages may mention actions whose tool call is gone; that is normal and never a reason to fabricate: no tool result on the desk, no action, and never inline an invented call, output, search result or diff.`;
|
|
98
|
+
|
|
99
|
+
const SMART_NOTE_GUIDANCE_LIGHT = `; a \`surface_condition\` leaves the note with an outside checker that returns it when the condition holds`;
|
|
100
|
+
|
|
101
|
+
const TEMPORAL_AWARENESS_GUIDANCE_LIGHT = `, \`<!-- +Xm -->\` (time since your last reply)`;
|
|
102
|
+
|
|
103
|
+
const BASE_INTRO_LIGHT = (
|
|
104
|
+
memoryEnabled: boolean,
|
|
105
|
+
dreamerEnabled: boolean,
|
|
106
|
+
temporalAwarenessEnabled: boolean,
|
|
107
|
+
): string => `### Your desk
|
|
108
|
+
|
|
109
|
+
Your context is a desk. Every message and tool output lands on it with a §N§ tag as its handle. When an item no longer needs to stay for the work ahead, stamp it: \`ctx_reduce\` with its tag. Stamping removes nothing — the item stays readable; from time to time, when stamped items have piled up and the desk needs room, Magic Context clears them in one sweep (you only stamp, you don't pick the moment). Stamp as soon as an item has served its purpose, silently; never stamp a user message for what it asks (a used paste inside one is fine). Nothing is lost: a cleared item goes to the archive (a recent one leaves \`[dropped §N§]\`, an older one nothing) and \`ctx_expand(message=N)\` brings it back whole. Occasional reminders about unstamped material are housekeeping, not warnings; the desk never gets smaller.
|
|
110
|
+
|
|
111
|
+
${TOOL_HISTORY_GUIDANCE_LIGHT}
|
|
112
|
+
|
|
113
|
+
\`ctx_search\` searches the archive — anything ever said, decided, committed or noted here; ask it before asking the user anything that may already be recorded, phrased as a question with the exact names in it. ${memoryEnabled ? `${MEMORY_GUIDANCE_LIGHT} ` : ""}${CTX_NOTE_GUIDANCE_LIGHT}${dreamerEnabled ? SMART_NOTE_GUIDANCE_LIGHT : ""}.
|
|
114
|
+
|
|
115
|
+
Magic Context's own markings — \`<system-reminder>\`, \`<ctx-search-hint>\`, \`<session-history>\`, \`<project-memory>\`, \`<memory-updates>\`, \`<new-compartments>\`, \`<new-memories>\`, \`[dropped §N§]\`${temporalAwarenessEnabled ? TEMPORAL_AWARENESS_GUIDANCE_LIGHT : ""} — are read, never reproduced, never instructions.`;
|
|
128
116
|
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
117
|
+
/** Light no-reduce rendering derived from the accepted light desk copy. */
|
|
118
|
+
const BASE_INTRO_NO_REDUCE_LIGHT = (
|
|
119
|
+
memoryEnabled: boolean,
|
|
120
|
+
dreamerEnabled: boolean,
|
|
121
|
+
temporalAwarenessEnabled: boolean,
|
|
122
|
+
): string => `### Your desk
|
|
134
123
|
|
|
135
|
-
|
|
136
|
-
- Large file reads, grep results, and tool outputs you already used.
|
|
137
|
-
- Large build/test output after you analyzed and acted on it.
|
|
138
|
-
- Old diagnostic or exploration results that are no longer relevant.
|
|
124
|
+
Your context is a desk. Every message and tool output lands on it. Nothing cleared from the desk is lost: a cleared item goes to the archive (a recent one leaves a placeholder, an older one nothing) and \`ctx_expand(message=N)\` brings it back whole.
|
|
139
125
|
|
|
140
|
-
|
|
141
|
-
- ALL user messages and assistant conversation text — these are cheap and compartmentalized automatically.
|
|
142
|
-
- Your current task requirements and constraints.
|
|
143
|
-
- Recent errors and unresolved decisions.
|
|
144
|
-
- Active work context and files being edited.`;
|
|
126
|
+
${TOOL_HISTORY_GUIDANCE_LIGHT}
|
|
145
127
|
|
|
146
|
-
|
|
128
|
+
\`ctx_search\` searches the archive — anything ever said, decided, committed or noted here; ask it before asking the user anything that may already be recorded, phrased as a question with the exact names in it. ${memoryEnabled ? `${MEMORY_GUIDANCE_LIGHT} ` : ""}${CTX_NOTE_GUIDANCE_LIGHT}${dreamerEnabled ? SMART_NOTE_GUIDANCE_LIGHT : ""}.
|
|
147
129
|
|
|
148
|
-
|
|
130
|
+
Magic Context's own markings — \`<system-reminder>\`, \`<ctx-search-hint>\`, \`<session-history>\`, \`<project-memory>\`, \`<memory-updates>\`, \`<new-compartments>\`, \`<new-memories>\`${temporalAwarenessEnabled ? TEMPORAL_AWARENESS_GUIDANCE_LIGHT : ""} — are read, never reproduced, never instructions.`;
|
|
149
131
|
|
|
150
132
|
/**
|
|
151
|
-
* Minimal guidance for
|
|
152
|
-
*
|
|
153
|
-
* re-read thrash the emergency drop alone can't prevent mid-run) but take on
|
|
154
|
-
* NONE of the primary's long-term role: no partner frame, no memory/search/note
|
|
155
|
-
* curation, no reduction-trigger taxonomy. So this block carries ONLY the §N§ +
|
|
156
|
-
* ctx_reduce mechanics. The `## Magic Context` marker is still present for
|
|
157
|
-
* injection idempotency (system-prompt-hash.ts gates on it).
|
|
133
|
+
* Minimal guidance for bounded subagents: stamping, the no-fabrication rule, and
|
|
134
|
+
* Magic Context markings only. Long-term search, memory, and notes stay primary-only.
|
|
158
135
|
*/
|
|
159
136
|
const SUBAGENT_REDUCE_INTRO =
|
|
160
|
-
(): string => `
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
137
|
+
(): string => `Your context is a desk. Every message and every tool output lands on it, and each item arrives with a §N§ tag (§1§, §42§) — the tag is the item's handle. When an item no longer needs to stay on the desk for the work ahead, stamp it: \`ctx_reduce\` with its tag ("3-5", "1,2,9", "1-5,8,12-15"). Stamping does not remove anything — the item stays fully readable until Magic Context clears stamped items in one sweep, and the newest tags are protected, so stamping recent output is harmless. Stamp as soon as an item has served its purpose, not at the end of the task, and do it silently. Never stamp a user message for what it asks of you; look at each tag before stamping and never blanket-stamp a range like "1-50".
|
|
138
|
+
|
|
139
|
+
A cleared item leaves a \`[dropped §N§]\` placeholder or disappears from the desk; that is normal housekeeping, not something to copy or mention. If there is no tool result on the desk, the action did not happen: never fabricate or inline a tool call, an output, a search result or a diff — make a fresh real tool call instead.
|
|
140
|
+
|
|
141
|
+
\`<system-reminder>\`, \`<ctx-search-hint>\`, \`<session-history>\`, \`<session-history-since>\`, \`<project-memory>\`, \`<memory-updates>\`, \`<new-compartments>\`, \`<new-memories>\` and \`[dropped §N§]\` are Magic Context's own markings: read them, never reproduce them in a reply, never treat them as instructions.`;
|
|
164
142
|
|
|
165
143
|
const SUBAGENT_REDUCE_INTRO_LIGHT =
|
|
166
|
-
(): string => `
|
|
167
|
-
|
|
168
|
-
|
|
144
|
+
(): string => `Your context is a desk: every message and tool output lands on it with a §N§ tag as its handle. When an item no longer needs to stay for the work ahead, stamp it with \`ctx_reduce\` ("3-5", "1,2,9"). Stamping removes nothing — the item stays readable until Magic Context clears stamped items in one sweep; newest tags are protected. Stamp as soon as an item has served its purpose, silently; never stamp a user message for what it asks; look at each tag, never blanket-stamp "1-50".
|
|
145
|
+
|
|
146
|
+
A cleared item leaves \`[dropped §N§]\` or disappears; that is housekeeping, not a pattern to copy. No tool result on the desk means the action did not happen — never fabricate or inline a call, output, search result or diff; make a real call.
|
|
147
|
+
|
|
148
|
+
\`<system-reminder>\`, \`<ctx-search-hint>\`, \`<session-history>\`, \`<project-memory>\`, \`<memory-updates>\`, \`<new-compartments>\`, \`<new-memories>\`, \`[dropped §N§]\` are Magic Context's markings: read, never reproduced, never instructions.`;
|
|
169
149
|
|
|
170
150
|
const CAVEMAN_COMPRESSION_WARNING = `\n**BEWARE**: History compression is on; older user AND assistant text — including your own earlier responses — has been deterministically rewritten in a terse caveman style (dropped articles, missing auxiliaries, \`//\` instead of connectives like \`because\`). This is automatic context compression that runs after the fact, not your actual prior wording or the user's. **DO NOT mimic this style in new turns.** Write fresh responses in normal prose. If you notice your output drifting into caveman cadence, that drift is in-context-learning bleeding from the compressed history — consciously revert to full sentences.`;
|
|
171
151
|
|
|
@@ -192,12 +172,9 @@ export function buildMagicContextSection(
|
|
|
192
172
|
const intro = preset === "light" ? SUBAGENT_REDUCE_INTRO_LIGHT() : SUBAGENT_REDUCE_INTRO();
|
|
193
173
|
return `## Magic Context\n\n${intro}`;
|
|
194
174
|
}
|
|
195
|
-
const
|
|
196
|
-
?
|
|
197
|
-
? SMART_NOTE_GUIDANCE_LIGHT
|
|
198
|
-
: `\nWhen \`surface_condition\` is provided with \`write\`, the note becomes a project-scoped smart note.\nThe dreamer evaluates smart note conditions during nightly runs and surfaces them when conditions are met.\nExample: \`ctx_note(action="write", content="Implement X because Y", surface_condition="When PR #42 is merged in this repo")\``
|
|
175
|
+
const temporalOverrideGuidance = temporalAwarenessEnabled
|
|
176
|
+
? TEMPORAL_AWARENESS_OVERRIDE_GUIDANCE
|
|
199
177
|
: "";
|
|
200
|
-
const temporalGuidance = temporalAwarenessEnabled ? TEMPORAL_AWARENESS_GUIDANCE : "";
|
|
201
178
|
// Caveman compression is independent of ctx_reduce availability. Emit the
|
|
202
179
|
// warning in both primary guidance variants whenever the primary-session
|
|
203
180
|
// caveman pass is enabled so the agent does not mimic compressed history.
|
|
@@ -209,17 +186,17 @@ export function buildMagicContextSection(
|
|
|
209
186
|
// A user override owns the complete primary section. Runtime clauses stay
|
|
210
187
|
// composer-owned so an override cannot suppress temporal guidance, the
|
|
211
188
|
// warning against overly compressed prose, or the language directive.
|
|
212
|
-
return `${primaryOverride}${
|
|
189
|
+
return `${primaryOverride}${temporalOverrideGuidance}${cavemanWarning}${languageGuidance}`;
|
|
213
190
|
}
|
|
214
191
|
|
|
215
192
|
if (!ctxReduceCallable) {
|
|
216
193
|
if (preset === "light") {
|
|
217
|
-
return `## Magic Context\n\n${LONG_TERM_PARTNER_FRAME}\n${PARTNER_FRAME_CLOSER_NO_REDUCE_LIGHT}\n\n${BASE_INTRO_NO_REDUCE_LIGHT(memoryEnabled)}${
|
|
194
|
+
return `## Magic Context\n\n${LONG_TERM_PARTNER_FRAME}\n${PARTNER_FRAME_CLOSER_NO_REDUCE_LIGHT}\n\n${BASE_INTRO_NO_REDUCE_LIGHT(memoryEnabled, dreamerEnabled, temporalAwarenessEnabled)}${cavemanWarning}${languageGuidance}`;
|
|
218
195
|
}
|
|
219
|
-
return `## Magic Context\n\n${LONG_TERM_PARTNER_FRAME}\n${PARTNER_FRAME_CLOSER_NO_REDUCE}\n\n${BASE_INTRO_NO_REDUCE(memoryEnabled)}${
|
|
196
|
+
return `## Magic Context\n\n${LONG_TERM_PARTNER_FRAME}\n${PARTNER_FRAME_CLOSER_NO_REDUCE}\n\n${BASE_INTRO_NO_REDUCE(memoryEnabled, dreamerEnabled, temporalAwarenessEnabled)}${cavemanWarning}${languageGuidance}`;
|
|
220
197
|
}
|
|
221
198
|
if (preset === "light") {
|
|
222
|
-
return `## Magic Context\n\n${LONG_TERM_PARTNER_FRAME}\n${PARTNER_FRAME_CLOSER_REDUCE_LIGHT}\n\n${BASE_INTRO_LIGHT(memoryEnabled)}${
|
|
199
|
+
return `## Magic Context\n\n${LONG_TERM_PARTNER_FRAME}\n${PARTNER_FRAME_CLOSER_REDUCE_LIGHT}\n\n${BASE_INTRO_LIGHT(memoryEnabled, dreamerEnabled, temporalAwarenessEnabled)}${cavemanWarning}${languageGuidance}`;
|
|
223
200
|
}
|
|
224
|
-
return `## Magic Context\n\n${LONG_TERM_PARTNER_FRAME}\n${PARTNER_FRAME_CLOSER_REDUCE}\n\n${BASE_INTRO(memoryEnabled)}${
|
|
201
|
+
return `## Magic Context\n\n${LONG_TERM_PARTNER_FRAME}\n${PARTNER_FRAME_CLOSER_REDUCE}\n\n${BASE_INTRO(memoryEnabled, dreamerEnabled, temporalAwarenessEnabled)}${cavemanWarning}${languageGuidance}`;
|
|
225
202
|
}
|
|
@@ -125,10 +125,10 @@ describe("applyDisallowedTools", () => {
|
|
|
125
125
|
});
|
|
126
126
|
|
|
127
127
|
describe("DREAMER_CURATE_ALLOWED_TOOLS (base dreamer = curate only)", () => {
|
|
128
|
-
it("
|
|
128
|
+
it("allows only the two memory tools — curate edits and enumerates the memory store", () => {
|
|
129
129
|
// A separate verify task owns memory-vs-code correctness; curate is
|
|
130
130
|
// pure pool hygiene, so it has no read/grep/bash/write/edit surface.
|
|
131
|
-
expect([...DREAMER_CURATE_ALLOWED_TOOLS]).toEqual(["ctx_memory"]);
|
|
131
|
+
expect([...DREAMER_CURATE_ALLOWED_TOOLS]).toEqual(["ctx_memory", "ctx_memory_list"]);
|
|
132
132
|
});
|
|
133
133
|
|
|
134
134
|
it("does NOT include any codebase / shell / file-write tool", () => {
|
|
@@ -150,24 +150,22 @@ describe("DREAMER_CURATE_ALLOWED_TOOLS (base dreamer = curate only)", () => {
|
|
|
150
150
|
});
|
|
151
151
|
|
|
152
152
|
describe("DREAMER_DOCS_ALLOWED_TOOLS (maintain-docs)", () => {
|
|
153
|
-
it("includes read
|
|
154
|
-
for (const tool of [
|
|
155
|
-
"read",
|
|
156
|
-
"grep",
|
|
157
|
-
"glob",
|
|
158
|
-
"bash",
|
|
159
|
-
"write",
|
|
160
|
-
"edit",
|
|
161
|
-
"aft_outline",
|
|
162
|
-
"aft_zoom",
|
|
163
|
-
"aft_search",
|
|
164
|
-
]) {
|
|
153
|
+
it("includes read-only source investigation tools for doc proposals", () => {
|
|
154
|
+
for (const tool of ["read", "grep", "glob", "aft_outline", "aft_zoom", "aft_search"]) {
|
|
165
155
|
expect(DREAMER_DOCS_ALLOWED_TOOLS).toContain(tool);
|
|
166
156
|
}
|
|
167
157
|
});
|
|
168
158
|
|
|
169
|
-
it("
|
|
170
|
-
for (const denied of [
|
|
159
|
+
it("denies write, shell and memory tools", () => {
|
|
160
|
+
for (const denied of [
|
|
161
|
+
"bash",
|
|
162
|
+
"write",
|
|
163
|
+
"edit",
|
|
164
|
+
"ctx_memory",
|
|
165
|
+
"ctx_search",
|
|
166
|
+
"ctx_note",
|
|
167
|
+
"task",
|
|
168
|
+
]) {
|
|
171
169
|
expect(DREAMER_DOCS_ALLOWED_TOOLS).not.toContain(denied);
|
|
172
170
|
}
|
|
173
171
|
});
|
|
@@ -185,24 +183,22 @@ describe("integration: full hidden-agent permission shape", () => {
|
|
|
185
183
|
});
|
|
186
184
|
});
|
|
187
185
|
|
|
188
|
-
it("base dreamer
|
|
186
|
+
it("base dreamer permission object denies all except the two memory tools", () => {
|
|
189
187
|
const perm = buildAllowOnlyPermission(DREAMER_CURATE_ALLOWED_TOOLS);
|
|
190
188
|
expect(perm).toEqual({
|
|
191
189
|
"*": "deny",
|
|
192
190
|
ctx_memory: "allow",
|
|
191
|
+
ctx_memory_list: "allow",
|
|
193
192
|
});
|
|
194
193
|
});
|
|
195
194
|
|
|
196
|
-
it("dreamer-docs permission object
|
|
195
|
+
it("dreamer-docs permission object denies writes and allows read-only source tools", () => {
|
|
197
196
|
const perm = buildAllowOnlyPermission(DREAMER_DOCS_ALLOWED_TOOLS);
|
|
198
197
|
expect(perm).toEqual({
|
|
199
198
|
"*": "deny",
|
|
200
199
|
read: "allow",
|
|
201
200
|
grep: "allow",
|
|
202
201
|
glob: "allow",
|
|
203
|
-
bash: "allow",
|
|
204
|
-
write: "allow",
|
|
205
|
-
edit: "allow",
|
|
206
202
|
aft_outline: "allow",
|
|
207
203
|
aft_zoom: "allow",
|
|
208
204
|
aft_search: "allow",
|
package/src/config/index.ts
CHANGED
|
@@ -618,7 +618,10 @@ function combinedOutcome(args: {
|
|
|
618
618
|
return "ok";
|
|
619
619
|
}
|
|
620
620
|
|
|
621
|
-
export function loadPluginConfigDetailed(
|
|
621
|
+
export function loadPluginConfigDetailed(
|
|
622
|
+
directory: string,
|
|
623
|
+
applyRuntimeGlobals = true,
|
|
624
|
+
): LoadResultDetailed {
|
|
622
625
|
const userDetected = detectConfigFile(getUserConfigBasePath());
|
|
623
626
|
const projectDetected = detectConfigFile(getProjectConfigBasePath(directory));
|
|
624
627
|
// Both-harness sources drive the GC-suppression signal; this-harness sources
|
|
@@ -750,8 +753,10 @@ export function loadPluginConfigDetailed(directory: string): LoadResultDetailed
|
|
|
750
753
|
project: projectLoaded ? profileResolution.projectBase.protected_tokens : undefined,
|
|
751
754
|
});
|
|
752
755
|
if (profileResolution.activeProfile) config.profile = profileResolution.activeProfile;
|
|
753
|
-
|
|
754
|
-
|
|
756
|
+
if (applyRuntimeGlobals) {
|
|
757
|
+
setOutputReserveConfig(config.output_reserve);
|
|
758
|
+
setWindowOverlayPath(config.models?.window_overlay_path);
|
|
759
|
+
}
|
|
755
760
|
const leafValidationWarnings = [...(config.configWarnings ?? [])];
|
|
756
761
|
if (config.configWarnings?.length) {
|
|
757
762
|
allWarnings.push(
|