Cortex inheritance map
Pinned to: IdeaFlowCo/cortex @ e93bf8c (2026-04-23, GitHub latest as of verification run)
Previous pin: e55f129 (2026-04-23 earlier) — superseded. Delta since: e93bf8c docs(plan): OpenClaw gateway lifecycle alignment design. Non-breaking for picortex inheritance.
Research-ingestion cutoff — revised 2026-04-23
Old rule: "Ignore Cortex commits before af3a76f5."
New rule: Don't inherit patterns from pre-af3a76f5 Cortex, but do study that era deliberately as an alternative-prototype source.
The pre-container "Piyush-era" window (238052c4 → d2d6a534, 2026-01-20 → 2026-01-23) is 9 commits of EC2 + SSH + Vercel + per-user Linux workspace with claude -c -p per turn. Tejas replaced it wholesale starting af3a76f5 because Cortex-as-product needed stronger per-tenant isolation. But for picortex-as-a-personal-tool that separation was unnecessary, and several Piyush-era patterns are exactly what we want — especially the bot/workspace physical split and the claude -c -p-per-turn execution model.
See piyush-era-design.md for the full study and docs/plans/2026-04-23-prototype-options.md for how it feeds into Option 2 of the current option bundle.
Operational guidelines
| Activity |
Rule |
| Quarterly Cortex diff-review |
Start at af3a76f5 (still) — these reviews track the Cortex-as-product direction, which is post-container. |
| Inheriting patterns (R-numbers) |
Start at af3a76f5 — R-numbers are Tejas-era work. |
| Studying alternative prototypes |
Read the Piyush era. It's a known-good design for the simpler single-user case. |
| Any new file grep |
If it touches backend/src/services/claudeService.ts or similar pre-container paths, read piyush-era-design.md first to know what you're looking at. |
Verification queries
# Post-container patterns to inherit:
git -C ~/code/cortex log af3a76f5..HEAD --oneline
# Pre-container prototype study (deliberate):
git -C ~/code/cortex log 238052c4..d2d6a534 --oneline
git -C ~/code/cortex show d2d6a534 --stat
Primary source: ~/code/cortex/docs/future-plans/texting-bot-groups/requirements.md
Legend: adopt • adapt • reject • defer
When Cortex updates R-numbers or adds new Rs, this map is re-reviewed at the quarterly checkpoint. Adoption decisions cite specific picortex files where the implementation lives (or will live).
R1 — Bot as primary surface
| # |
Cortex text (paraphrase) |
picortex decision |
Notes |
| R1.1 |
Bot is the main UI; web is supplementary |
adopt |
|
| R1.2 |
DM with bot = personal agent |
adopt |
iMessage 1:1 = picortex personal chat |
| R1.3 |
Group with bot = group agent |
adopt |
iMessage group with bot = group chat |
R2 — Workspace identity
| # |
Cortex |
picortex |
Notes |
| R2.1 |
Each chat has own filesystem keyed on durable chat ID |
adapt |
Same invariant; Linux user instead of Docker container. ADR-0002 |
| R2.2 |
Workspace survives restart |
adopt |
home dir persists |
R3 — Lifecycle
| # |
Cortex |
picortex |
Notes |
| R3.1 |
Eager provisioning + warm pool |
adapt |
Eager yes; warm pool deferred to S6 |
| R3.2 |
Idle hibernation |
adopt |
7 days |
| R3.3 |
7-day destroy-but-keep-volume |
adapt |
30-day archive-then-delete |
R4 — Attention gating
| # |
Cortex |
picortex |
Notes |
| R4.1 |
Modes: always / mentions-only / discriminate / discriminate-quiet / silent |
adopt |
Spec 005 |
| R4.2 |
Rules-first then LLM |
adopt |
|
| R4.3 |
Discriminator prompt is git-versioned .cortex/prompts/discriminator.md |
adapt |
Rename to .picortex/ |
R5 — Backend authority
| # |
Cortex |
picortex |
Notes |
| R5.1 |
Backend = canonical log; container cache only |
adopt |
SQLite instead of Cortex's DB |
| R5.2 |
Container can't authorize |
adopt |
|
| R5.3 |
Message edits / deletes are backend ops |
adopt |
|
| R5.4 |
Cross-chat ops need out-of-band challenge |
adopt |
|
| R5.5 |
Challenge is a DM reply |
adopt |
Spec 009 pending |
| R5.6 |
Never trust workspace-declared user identity |
adopt |
|
| # |
Cortex |
picortex |
Notes |
| R6.* |
listMyChats, readChatTranscript, searchChat, etc. |
defer |
Not in v0.1 |
R7 — Sharing bridge
| # |
Cortex |
picortex |
Notes |
| R7.1 |
Personal→shared v1 |
adopt |
Stage S9 |
| R7.2 |
Shared→personal v2 |
defer |
|
| R7.3 |
Every op = BridgeEvent row |
adopt |
|
R8 — Identity
| # |
Cortex |
picortex |
Notes |
| R8.1 |
Phone as primary; SMS OTP login |
adapt |
Jacob's phone is the only admin; no OTP yet |
| R8.2 |
Email optional |
defer |
|
| R8.3 |
Per-chat scoped tokens |
adopt |
Noos OAuth scopes for web UI |
| R8.4 |
N groups = N tokens |
adopt |
|
R9 — Linq channel
| # |
Cortex |
picortex |
Notes |
| R9.1 |
HMAC-SHA256 {t}.{body} on inbound |
adopt |
Identical |
| R9.2 |
5-min skew, replay guard |
adopt |
|
| R9.3 |
Normalize Linq → internal event shape |
adopt |
|
| R9.4 |
Outbound retry with idempotency |
adopt |
|
R10–R19 — other
Covered in the Cortex docs but not crystallized here. When picortex implements a subsystem, the PR adds a row above.
Divergences (major)
| Picortex choice |
Cortex equivalent |
Why |
| Linux user per chat |
Docker container per chat |
Spin-up latency, resource cost |
| SQLite |
Postgres |
Single-user simplicity |
| No dashboard, just per-chat web terminal |
Session management dashboard |
Explicit user directive |
| Mobile-first UI from day 1 |
Desktop-first, mobile responsive |
Jacob's use case is phone-led |
Upstream contributions
- linq-sim thread/reply support (Stage S2) — picortex improves the shared simulator; PR goes back to IdeaFlowCo/cortex.