Skip to content

About

Open-source Codex distribution powered by Spine: subtask-tree context compilation for long-horizon coding at 32%-74% lower cost.

Topics

Resources

Contributing

Security policy

Stars

154 stars

Watchers

0 watching

Forks

Latest commit

 

History

13,483 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SpineCodex mark SpineCodex

OpenAI Codex powered by Spine — compile subtask trees into structured context for long-horizon coding.

arXiv 2610.37224 · npm version · npm downloads · Apache-2.0 license

English · 简体中文

SpineCodex v0.5.1 terminal demonstration

Overview

Long-horizon software engineering naturally unfolds as nested subtasks, yet large language models consume a prefix-sensitive linear context. Flat history compaction loses subtask boundaries and triggers repeated file rereads, while spawning a child agent for every subtask adds heavy cross-session handoff and waiting overhead on sequential work.

SpineCodex places long-horizon execution under a persistent work tree (SpineTree)—acting as the structural spine from which subtasks branch out and fold back. The agent declares subtask boundaries as it reasons, keeping local sequential steps inline while delegating independent branches in parallel when needed. Before each model call, the Spine runtime compiles SpineTree into minimal effective context—replacing completed subtasks with their returned results while keeping unfinished parent context byte-for-byte intact for prefix-cache reuse.

Quick Start

Install globally and run directly—SpineCodex inherits your existing ~/.codex configuration, credentials, and skills out of the box:

npm install -g @spinejit/spine-codex@latest
spine-codex
  • Upstream compatibility: v0.6.0 tracks OpenAI Codex 0.170.0.
  • Optional local memory view: Run /experimental in the TUI to enable Spinetree memory projection (exports closed-node memory under .codex/spinetree/ for inspection).

How Spine Works

Spine architecture overview

Spine resolves the tension between nested work and linear context across three coordinated layers:

  • Agent-declared boundaries, runtime-managed structure: As the agent reasons, it marks subtask entries and conclusions via lightweight primitives (Open, Close, Next, Spawn). The compilation frontend maintains the persistent SpineTree so completed intermediate traces remain archived without cluttering active context.
  • Unified work tree without unnecessary subagent overhead: SpineTree decouples boundary management from subagent spawning—sequential subtasks open and close locally within the current session (Open / Close / Next), while independent tasks scale out in parallel via Spawn, returning results into the same tree.
  • Just-in-time context compilation & prefix-cache hits: Because innermost subtasks finish first, completed branches collapse at the active suffix into concise returned results. Preceding parent context stays unchanged and continues to hit prompt caches.

For formal definitions, compilation rules, and ablation studies, see the paper: Spine: Compiling Subtask Trees into Structured Context for Long-Horizon Coding Agents.

Benchmark Highlights

Evaluated across three long-horizon software engineering benchmarks (arXiv:2610.37224):

Benchmark Setting SpineCodex vs. Baseline
SWE-Milestone GPT-5.6 Sol (98 milestones) 42.6% vs. 38.1% Score (+11.8%), 19 vs. 14 resolved, -45% avg. input tokens/req, -32.4% total cost vs. native Codex
SWE-Milestone Grok 4.6 (98 milestones) 40.4% vs. 35.5% Score (+13.8%), -37.9% total cost vs. native Codex
SWE-Milestone Context-management baselines (GPT-5.6 Sol) -73.7% total cost vs. recursive subagent delegation (19 vs. 17 resolved); +14.8%–16.7% Score & -22.7%–58.1% cost vs. history compression/folding
ProgramBench GPT-5.6 Sol / Grok 4.6 (50 tasks) 73.35% vs. 62.55% (+17.3% rel.) avg. pass rate & 7/50 vs. 2/50 tasks ≥95% (GPT-5.6 Sol); +10.2% avg. pass rate & -13.3% cost (Grok 4.6)
FrontierSWE 10 open-ended tasks (5 trials/task) Improves Mean@5 on 8/10 tasks (GPT-5.6 Sol, -6.7% cost) and 6/10 tasks (Grok 4.6, -19.2% cost)
Recent Releases
  • v0.6.0 — Updates the upstream OpenAI Codex baseline to 0.170.0. Release notes
  • v0.5.1 / v0.5.0 — Updates upstream OpenAI Codex baseline to 0.164.0 with full GPT-6.1-Sol / GPT-6-Astra support, embedded app-server startup isolation, prompt-cache preservation in spawned children, and Spine lineage preservation across compacted sessions.
  • v0.4.0 — Updates upstream baseline to 0.153.4 and removes legacy 4096-item source-ledger and 1 MiB synthetic context-plan caps for ultra-long sessions.
  • v0.3.0 — Introduces the SpineSDK sampling-boundary runtime with unified Open / Close / Next / Spawn primitives.

Full release notes: GitHub Releases.

Spine Ecosystem

  • SpineCodex (this repository) — Standalone Codex CLI distribution with Spine built in (@spinejit/spine-codex).
  • Spine for Pi & DeepSeek Harness — Official Spine plugins for Pi (@spinejit/pi-spinejit) and DeepSeek Harness (@spinejit/dsh-spinejit), plus companion TUI extensions including @spinejit/pi-compact-tree.

Citation

If you find Spine or SpineCodex useful in your research or engineering workflow, please cite our paper:

@misc{xiang2026spine,
  title         = {Spine: Compiling Subtask Trees into Structured Context for Long-Horizon Coding Agents},
  author        = {Jiahong Xiang and Kunqiu Chen and Lingming Zhang and Yuqun Zhang},
  year          = {2026},
  eprint        = {2610.37224},
  archivePrefix = {arXiv},
  primaryClass  = {cs.SE},
  url           = {https://arxiv.org/abs/2610.37224}
}

License & Contributing

SpineCodex is maintained by Jiahong Xiang and Kunqiu Chen under the Apache-2.0 License. Upstream OpenAI Codex and derived components retain their attribution in NOTICE. Bug reports and feature discussions are welcome in GitHub Issues.

About

Open-source Codex distribution powered by Spine: subtask-tree context compilation for long-horizon coding at 32%-74% lower cost.

Topics

Resources

Contributing

Security policy

Stars

154 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages