Skip to content

Wire outcomes + decisions/journal + session hooks for cortex-dbx MCP#2

Open
jessekemp1 wants to merge 5 commits into
mainfrom
fix/outcomes-and-session-hooks
Open

Wire outcomes + decisions/journal + session hooks for cortex-dbx MCP#2
jessekemp1 wants to merge 5 commits into
mainfrom
fix/outcomes-and-session-hooks

Conversation

@jessekemp1
Copy link
Copy Markdown
Owner

Summary

  • Outcomes endpoints (d1973e8)/v2/outcomes and /v2/outcomes/stats were returning 501 because cortex.v2.learning.outcomes.OutcomeDetector never existed. Rewired both to read directly from ~/.cortex/model_outcomes.jsonl, the same backing store the intelligence layer already uses.
  • Decisions journal endpoint (4270850) — added /decisions/journal that accepts the MCP tool's schema (decision, context, alternatives, rationale) and writes to ~/.cortex/decisions.jsonl. The existing /decisions/record expects Co-Navigator UI fields and was the wrong shape for MCP callers.
  • Session lifecycle hooks (d1973e8, b512973)hooks/session_briefing.sh (SessionStart) surfaces recommendations + plan progress; hooks/session_debrief.sh (Stop) prompts the agent to record decisions before exit. Latest update aligns with the cortex-dbx MCP integration shape.
  • Gap analysis spec (2975733, 806839b)CORTEX_FIXES_SPEC.md maps the 18 cortex MCP tools against cortex-dbx: 4 broken, 3 missing, 3 degraded. Root cause: the FastAPI bridge proxy layer that cortex-dbx avoids via direct function calls.

Test plan

  • curl localhost:8765/v2/outcomes returns 200 with entries from ~/.cortex/model_outcomes.jsonl
  • curl localhost:8765/v2/outcomes/stats returns 200 with aggregate counts
  • POST to /decisions/journal with {decision, context, alternatives, rationale} appends a row to ~/.cortex/decisions.jsonl
  • SessionStart hook fires on Claude Code launch and prints the briefing without error
  • Stop hook fires and prompts the debrief without blocking

This pull request and its description were written by Isaac.

Outcomes endpoints (/v2/outcomes, /v2/outcomes/stats) were returning 501
because cortex.v2.learning.outcomes.OutcomeDetector never existed. Rewired
to read directly from ~/.cortex/model_outcomes.jsonl — same backing store
the intelligence layer already uses.

Added Claude Code session lifecycle hooks:
- session_briefing.sh (SessionStart): surfaces recommendations + plan progress
- session_debrief.sh (Stop): prompts agent to record decisions before exit
The existing /decisions/record endpoint expects Co-Navigator UI fields
(prediction_id, scenario_chosen, etc.). Added /decisions/journal that
accepts the MCP tool's schema (decision, context, alternatives, rationale)
and writes to the same decisions.jsonl file.
Maps the 18 cortex MCP tools against cortex-dbx: 4 broken, 3 missing,
3 degraded. Root cause is the FastAPI bridge proxy layer that
cortex-dbx avoids via direct function calls. Per-tool fix specs.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant