cotext
cotext is a standalone Rust CLI and TUI for keeping project tracking context in one structured place instead of scattering raw markdown across ad hoc files.
This project is built jointly by humans and OpenAI Codex. Treat AI-generated changes like any other contribution: review them, test them, and keep the durable project context in sync.
It manages five context categories:
designnoteprogresstododeferred
The tool is built for both humans and code agents. It can:
- create and update structured context entries
- render a concatenated packet for humans, generic agents, Codex, or Claude Code
- generate agent-facing scaffolding for Codex and Claude Code
- open a single-page terminal UI for browsing, editing, previewing, and copying structured packets
- document a repeatable read, narrow, implement, and sync workflow for code agents
Why
Large coding projects usually end up with:
- design docs in one file
- progress notes in another
- TODOs in a third place
- deferred work hidden in issue comments or scratch notes
cotext gives all of that a uniform storage model under .cotext/, while still keeping the data plain-text and git-friendly.
Storage Model
Each project initialized with cotext gets a .cotext/ folder:
.cotext/
cotext.toml
entries/
design/
note/
progress/
todo/
deferred/
Every entry is a markdown file with YAML front matter:
id: tui-copy-loop
title: TUI clipboard review loop
category: design
section: tui/review
status: active
tags:
- -
That keeps the storage readable while allowing the CLI and TUI to filter, group, and render it consistently.
Install
Once cotext is published to crates.io, install it with:
For local development or a checkout from source:
Quick Start
CLI Surface
cotext init [path]
cotext new <category> <title>
cotext update <id>
cotext list
cotext show <id>
cotext render [--audience human|agent|codex|claude]
cotext agent install <codex|claude|all>
cotext tui
Useful patterns:
cotext render --audience codexUse when a Codex session should read the current project packet.cotext render --category todo --category deferredUse when you only want next work and postponed work.cotext update <id> --append "..."Use for lightweight progress updates.cotext agent install all --overwriteRefresh the generated project-local agent assets.
Agent Integration
Codex
cotext agent install codex writes:
AGENTS.mdguidance that tells Codex to read and update context throughcotext.codex/skills/cotext-context/SKILL.md.codex/skills/cotext-context/agents/openai.yaml
If you also pass --codex-skill-dir <path>, the same skill bundle is installed into that extra Codex skill directory as a second copy.
Claude Code
cotext agent install claude writes:
CLAUDE.mdguidance for the repository.claude/skills/cotext-context/SKILL.md.claude/commands/cotext.md.claude/commands/cotext-sync.md
This follows Claude Code's project-local customization model so a repository can ship its own context workflow.
Agent Workflow
cotext is designed to be read at the start of a substantial agent task and synced at the end if durable project context changed.
A good default loop is:
- Load the packet with
cotext render --audience codexorcotext render --audience claude. - Narrow the view with
cotext list --category ...,cotext render --category ..., orcotext show <id>when the task is scoped. - Do the implementation or analysis.
- Write back durable design, note, progress, todo, or deferred changes with
cotext update,cotext new, orcotext tui.
Useful patterns:
cotext list --category todo --status active --status plannedSurface the actionable queue.cotext render --category progress --category todo --audience codexLoad a focused packet when resuming active work.cotext update <id> --append "Validation: cargo test"Add short evidence to an existing progress entry.cotext update <id> --status doneClose a completed todo.cotext new note "Important environment caveat" --section env/setup --tag opsCapture a new durable warning or operating fact.
Category guide:
design: architecture, invariants, tradeoffs, durable decisionsnote: warnings, caveats, environment facts, operator remindersprogress: landed work, evidence, next steptodo: the next concrete taskdeferred: intentionally postponed future work
For the detailed workflow, maintenance notes, and regeneration steps for the checked-in agent guidance, see docs/agent-workflow.md.
Development Checks
This repository ships both GitHub Actions and pre-commit automation around the same Rust quality gate:
cargo fmt --all -- --checkcargo check --all-targets --all-featurescargo clippy --all-targets --all-features -- -D warningscargo test
Install the local hooks with:
To run the full hook set on demand:
Publishing is handled by GitHub Actions. The publish workflow expects a CARGO_REGISTRY_TOKEN repository secret, requires Cargo.toml to declare license or license-file, and verifies that a GitHub release tag like v0.1.0 matches Cargo.toml before it runs cargo publish.
TUI
cotext tui opens a single-page terminal board with:
- live project stats and category cards across the top
- a filtered entry list on the left
- detail and preview/editor panes on the right
- staged quick-create prompts for title, section, and tags before the first file write
- packet preview modes for the current entry, current category, open category work, and open project work
- clipboard export for the selected entry or the whole current category using the current preview audience
- popup help and delete-confirmation panels without leaving the main board
Key bindings:
Tab/Shift-Tab: switch categoryj/k: move selectionn/+: create a new entry in the current categoryd/Delete: delete the selected entry with confirmatione: edit the selected bodyt: edit the selected titles: edit the selected sectiong: edit the selected tagsp: cycle preview modea: cycle preview audience?in browse mode, orF1anywhere: open or close helpPageUp/PageDown: scroll the preview paneCtrl-s: save changesEsc: cancel editingS: cycle statusc: copy the selected entry packetC: copy the current category packetq: quit
Current Scope
The first implementation is intentionally simple:
- entries are markdown files with YAML front matter
- section filtering is prefix-based
- the TUI edits one selected item at a time, but now covers body, title, section, and tags
- new entries collect metadata before the initial file write so ids and paths start correct
- selected entries can be deleted from the TUI, including pruning empty section directories on disk
- packet preview can switch between entry, category, and open-work views without leaving the TUI
- clipboard export is text-based and audience-aware, aimed at quick paste into an agent session
That is enough to consolidate design notes, awareness notes, progress, next work, and deferred work without introducing a database or web app.