decision-state.json

INPUT/OUTPUT: structured decisions; superseded items are retained but no longer rendered into prompt summaries

/home/matrix-lite/state/persistent-chat/decision-state.json

{
  "schema": "persistent_chat_decision_state_v1",
  "updated": "2026-05-27T17:33:22.632302+00:00",
  "active_threads": [
    {
      "key": "matrix-lite-persistent-chat-memory-runtime-2026-05-16",
      "created": "2026-05-16T21:00:00+00:00",
      "updated": "2026-05-16T21:00:00+00:00",
      "topic": "Matrix-lite persistent-chat memory runtime",
      "status": "active",
      "conclusion": "Canonical persistent-chat memory now lives under /home/matrix-lite/state/persistent-chat; prompts/pages/runtime use Matrix-lite app/workspace paths, not legacy OpenClaw paths. Fast heartbeat produces packets; slow model heartbeat curates durable memory/reflection.",
      "files": [
        "/home/matrix-lite/state/persistent-chat/perpetual-log.jsonl",
        "/home/matrix-lite/app/scripts/persistent-chat-memory",
        "/home/matrix-lite/app/scripts/persistent-chat-model-heartbeat",
        "/home/matrix-lite/app/matrix_lite/daemon.py"
      ],
      "last_verified": "Fast heartbeat and prompt/page deployment verified after Matrix-lite migration cleanup."
    },
    {
      "key": "safe-agent-patch-workflow",
      "created": "2026-05-18T06:59:23.374034+00:00",
      "updated": "2026-05-18T06:59:23.374067+00:00",
      "topic": "Safe agent patch workflow",
      "status": "active",
      "conclusion": "Need a robust and safe way for persistent-chat/background agents to propose and apply patches to agent-maintained scripts/configs without broad self-edit permissions.",
      "files": [
        "/home/matrix-lite/app/config/opencode/persistent-chat.opencode.json",
        "/home/matrix-lite/app/scripts/persistent-chat-model-heartbeat",
        "/home/matrix-lite/app/scripts/persistent-chat-reflection"
      ],
      "open_questions": [
        "Design a bounded patch helper or approval-mediated workflow that supports needed script/config patches while avoiding wildcard edit access to systemd-executed scripts."
      ],
      "last_verified": "User requested adding this to later todos on 2026-05-18."
    },
    {
      "key": "persistent-chat-stale-session-and-compaction-policy",
      "created": "2026-05-18T08:25:21.694489+00:00",
      "updated": "2026-05-18T08:25:21.694530+00:00",
      "topic": "Persistent chat stale session and compaction policy",
      "status": "active",
      "conclusion": "Avoid reloading or replacing the main persistent-chat session unless context pressure, stale/incomplete ACPX session state, model-mediated reload scripts, or an emergency recovery path requires it. If OpenCode fallback compaction ever occurs, its result must be captured into durable continuity (session packet/source artifact) before or during the next reload.",
      "files": [
        "/home/matrix-lite/app/matrix_lite/daemon.py",
        "/home/matrix-lite/app/scripts/persistent-chat-memory",
        "/home/matrix-lite/app/scripts/persistent-chat-reload"
      ],
      "open_questions": [
        "Design a deterministic source artifact for ACPX/OpenCode compaction summaries so fallback compaction output is injected into session packets without direct packet edits."
      ],
      "last_verified": "User requested this policy on 2026-05-18 while investigating ACPX timeout/stale session failures."
    },
    {
      "key": "investigate-session-start-metrics",
      "created": "2026-05-18T10:25:14.250542+00:00",
      "updated": "2026-05-18T10:25:14.250575+00:00",
      "topic": "Investigate persistent-chat session-start and hidden prompt overhead",
      "status": "active",
      "conclusion": "Measure why live ACPX input/context usage is much higher than visible turn packet estimates. Break down session-start packet, character/bootstrap, manifest, MCP/tool/system overhead, provider/OpenCode retained context, and any components Matrix-lite does not directly control.",
      "files": [
        "/home/matrix-lite/app/matrix_lite/daemon.py",
        "/home/matrix-lite/app/scripts/persistent-chat-reload"
      ],
      "open_questions": [
        "Produce an authoritative or best-effort per-component prompt/context budget for fresh backend sessions and steady-state turns."
      ],
      "last_verified": "User requested this follow-up on 2026-05-18 after ACPX reported ~25.7k input tokens while visible packets appeared closer to ~7-10k plus overhead."
    },
    {
      "key": "obs-features-2026-05-18",
      "created": "2026-05-18T11:43:26.958490+00:00",
      "updated": "2026-05-18T11:43:26.958520+00:00",
      "topic": "observability-feature-requests",
      "status": "approved",
      "conclusion": "Four items agreed: event-log, per-failure injection, session-event-log exploration, helper-first. See workspace doc.",
      "files": [
        "/home/matrix-lite/workspace/persistent-chat/observability-feature-requests-2026-05-18.md"
      ]
    },
    {
      "key": "smallcode-inspired-improvements-2026-05-18",
      "created": "2026-05-18T12:50:00+00:00",
      "updated": "2026-05-18T20:30:44.066528+00:00",
      "topic": "SmallCode-inspired architecture improvements",
      "status": "deferred",
      "conclusion": "Reviewed SmallCode coding agent (87% benchmark with 4B model). Adopted subset of ideas for our stack. Model vibe compatibility testing also needed before switching.",
      "source": "https://github.com/Doorman11991/smallcode",
      "items": [
        {
          "id": "forgiving-tool-parser",
          "summary": "Forgiving tool call parser — parse model output from JSON/YAML/XML/plain text, auto-repair param mistakes",
          "priority": "deferred",
          "note": "Need but later — complex to implement in current stack. Relevant when we switch to smaller local models."
        },
        {
          "id": "2-stage-tool-routing",
          "summary": "2-stage tool routing — model picks category first, then gets only relevant tool schemas",
          "priority": "medium",
          "scope": "subagents",
          "note": "Good for subagents/background agents. Main chat should keep full tool availability (on-demand switching to be added later)."
        },
        {
          "id": "patch-first-editing",
          "summary": "Robust search-and-replace patch primitive — safer than full-file writes for smaller models",
          "priority": "high",
          "scope": "global",
          "note": "GLM incident confirmed truncation risk. GPT-5.5 already thinks in apply_patch patterns. Need our own robust version."
        },
        {
          "id": "early-stop-detection",
          "summary": "Detect repetition loops and runaway output to save tokens",
          "priority": "needs-design",
          "scope": "global",
          "note": "Open question: how to add this in current ACP structure? Needs design discussion."
        },
        {
          "id": "model-profiles",
          "summary": "Per-model config: context length, tool format, chat template, strengths/weaknesses",
          "priority": "medium",
          "scope": "subagents",
          "note": "Primarily for subagents/background agents. Configure via profiles which model gets which tool set, prompt style, etc."
        }
      ],
      "open_questions": [
        "How to implement early-stop detection (repetition/runaway) within current ACPX/OpenCode architecture?",
        "Model memory/vibe testing needed: see how curated memory + prompts work with DeepSeek Pro (spirals/hysterical), DeepSeek Flash (very terse), and other models before committing to switches.",
        "Can prompt engineering mitigate model personality quirks (e.g., DeepSeek Pro's tendency to spiral)?",
        "How to design a robust apply_patch primitive that works across all target models?"
      ],
      "files": [],
      "notes": [
        "Still wanted but not urgent for next session reload; preserved in decision-state.json"
      ],
      "superseded_at": null
    },
    {
      "key": "observability-timeline-frs-2026-05-18",
      "created": "2026-05-18T14:31:04.616938+00:00",
      "updated": "2026-05-18T14:31:04.616981+00:00",
      "topic": "Observability timeline feature requests",
      "status": "active",
      "conclusion": "Implement a compact event timeline as a derived/indexed view of canonical persistent logs plus helper-only append support for agent/infrastructure events. Include user and assistant messages as compact/pointer-backed events, keep it rebuildable/idempotent with deterministic source ids, and aggregate existing recent-failures/context/reload/page/timer artifacts rather than creating a competing source of truth. Per-failure notices should be injected before the next model turn and consumed only after a successful final reply. Helper-first is the default for persistent-chat structured metadata. Defer ACPX session event_log exploration until after timeline/failure/context helpers.",
      "files": [
        "/home/matrix-lite/app/matrix_lite/daemon.py",
        "/home/matrix-lite/app/scripts/matrix-lite-status-mcp.py",
        "/home/matrix-lite/app/scripts/persistent-chat-memory"
      ],
      "open_questions": [
        "Design event-log rebuild/sync/push/tail/search with deterministic ids and source pointers while allowing safe helper-appended agent events.",
        "Add FR2 failure notice queue with consume-on-success semantics at daemon/gateway level.",
        "Add clearer unified context/reload helper output if current status MCP report remains insufficient.",
        "Later investigate ACPX session JSON event_log contents and whether a read-only helper is useful."
      ],
      "last_verified": "User clarified FR1-FR5 priorities and deferrals on 2026-05-18."
    },
    {
      "key": "architecture-doc-created-0ac5d617ed",
      "created": "2026-05-19T14:50:51.922718+00:00",
      "updated": "2026-05-19T14:50:51.922750+00:00",
      "topic": "architecture-doc-created",
      "status": "active",
      "conclusion": "Created /home/matrix-lite/workspace/persistent-chat/architecture.md as human-readable architecture doc. Agents should update this file when architecture changes. Keep it human-readable for Gleb."
    },
    {
      "key": "curation-workflow-directive-2026-05-26",
      "created": "2026-05-27T17:33:19.612135+00:00",
      "updated": "2026-05-27T17:33:19.612178+00:00",
      "topic": "Curation workflow directive",
      "status": "active",
      "conclusion": "User endorsed agent-proposed curation workflow: inventory candidates, process small batches, promote only durable preferences/corrections/operational directives, mark stale/noisy candidates via deterministic helper, update only source artifacts (curated-memory.md, curator-journal.md, semantic-candidates.jsonl, operational synthesis), never edit generated packets/status files or perpetual-log.jsonl.",
      "notes": [
        "Source: user message 2026-05-26T19:02:27Z, log_index 3628"
      ]
    },
    {
      "key": "compaction-paranoia-user-stance-2026-05-25",
      "created": "2026-05-27T17:33:22.632203+00:00",
      "updated": "2026-05-27T17:33:22.632243+00:00",
      "topic": "User compaction paranoia",
      "status": "active",
      "conclusion": "User is explicitly paranoid about compaction because they have seen agents lose the point when given a to-do after compaction. User is not sure current system captures everything; compaction can handle current topics but may lose nuanced instructions or the broader point.",
      "notes": [
        "Source: user message 2026-05-25T03:17:34Z, log_index 3490"
      ]
    }
  ],
  "file_facts": [
    {
      "path": "/home/matrix-lite/app/scripts/persistent-chat-memory",
      "updated": "2026-05-16T21:00:00+00:00",
      "note": "Current canonical persistent-chat memory helper"
    },
    {
      "path": "/home/matrix-lite/app/scripts/persistent-chat-model-heartbeat",
      "updated": "2026-05-16T21:00:00+00:00",
      "note": "Current model heartbeat script"
    },
    {
      "path": "/home/matrix-lite/xdg/persistent-chat/opencode/opencode.json",
      "updated": "2026-05-17T11:54:00+00:00",
      "note": "Live runtime opencode config for persistent-chat"
    }
  ]
}