Skip to content

Phase D: Move the Cortex store, pricing, session API and attribution into the binary #1727

Open

Description

@huang195

Part of #1714 · phase D · Section 8 · design in #1717 (docs/superpowers/specs/2026-11-07-praxis-mode-design.md)

Goal

Make Cortex one Rust binary on the Praxis crates, in the shape of praxis-ai today. agentop does not change.

Scope

  • Port about 13.7k lines of Go into the binary:

    • the session store, archive and timeline, as a Cortex store crate on SQLite in the pattern of praxis-ai's store crates.
    • pricing and the ledger, as a Rust pricing filter, then Tokenomics when it is on par.
    • the session API, as filters on :47601 (/v1/events through StreamingTerminalResponse).
    • attribution.
  • Attribution moves together with the store, because the store's events feed its state. The Go front door passes the client's socket address in X-Cortex-Client, and the binary does the process lookup itself.

  • cortex_record writes the same record type to the store in process. /v1/ingest and the emitter's HTTP stream go away.

  • Decide: an importer for existing archives, or only the retention window. Decide each remaining plugin: port or retire. Split this issue into sub-issues before work starts.

  • Decide the path for the rows that the Go front door still writes (refusals, gateway_unavailable, tunnels, WebSockets) into the binary's store. Proposal: the front door posts them to the ingestion endpoint, now in the binary. Test it before phase C.

  • Decide how a ported filter that reads parsed facts in both directions (opa, session budget) fits the chain.

Done when

  • The same agentop session gives the same /v1/sessions, /v1/events, /v1/usage and timeline answers against the Go and the Rust store.
  • The Go tests of the ported packages pass as parity cases.

Depends on

Trigger: praxis#782 and praxis#1447 in a release, the same trigger as phase C. This phase runs first, then C. (Changed 2026-11-10: users are not asked to use --praxis, so no work starts here before Praxis upstream is ready. See #1714.)

Assisted-By: Claude (Anthropic AI) [email protected]

Activity

  1. self-assigned this
    on Nov 7, 2026
  2. added
    laptop
    on Nov 7, 2026
  3. huang195 commented on Nov 11, 2026

    @huang195
    MemberAuthor

    Gate (decided 2026-11-11): #1785 must be done before this phase starts. #1785 puts PPE into cortex-gateway under --praxis and deprecates the Go CPEX plugin. See the Plan and Gates sections of #1714.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

laptop

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions