| Name | Meaning |
|---|---|
| Contextify | The product and open-source project this README describes (what we ship and iterate on in public). |
| Context Map | The right-hand structured view inside the app (topology of mainline/branches and node operations). |
Earlier revisions of this README only referred to “Context Map” as the project name. The README you are reading now is intentionally framed around Contextify as the public product, while keeping the in-app “Context Map” terminology where the UI uses it.
Multi-turn collaboration context is often flattened into a single chronological sequence and passed forward as a fixed whole, which makes it hard to dynamically organize what should matter for the next step. Contextify explores the Mixed-Initiative Context idea: treat accumulated context as something humans and the model can structure together—branch, bound, include/exclude, and reuse—instead of only repairing it through new prompts.
Research paper: Mixed-Initiative Context: Structuring and Managing Context for Human-AI Collaboration (Haichang Li, Qinshi Zhang, Piaohong Wang, Zhicong Lu).
Also indexed on alphaXiv: overview.
The paper-level motivation is that multi-turn context is often flattened into one chronological stream, while real collaboration contains branching, temporary paths, and shifting intent.
This concept figure introduces the shift from implicit context handling to explicit context structuring and management, with mixed initiative between human and AI.
This UI figure shows the system instantiation of the concept: conversational interaction and Context Map are synchronized, so users can directly operate on context units/structure while AI provides structure-level suggestions.
For full details, see the paper: arXiv:2604.07121.
| You get | In practice |
|---|---|
| Structured threads | Mainline + branches instead of one undifferentiated transcript |
| Scoped reasoning | Include / Exclude at node level so irrelevant turns do not pollute the next reply |
| Convergence | Promote a branch outcome back to the main line of work |
| Reuse | Pattern / SOP-style extraction from successful flows |
| Demo | Watch: YouTube demo · Run locally below |
Requirements: Node.js 20+, npm 9+
npm install
cp .env.example .env.local
# Edit .env.local: set at least OPENAI_API_KEY
npm run devOpen http://localhost:3000.
For all providers, Supabase sync, and deployment: docs/deployment.md · docs/supabase.md.
npm run dev # local dev
npm run build # production build
npm run preview # preview build
npm run lint # TypeScript check
npm run test:mainline # mainline / structure regression script- Projects + Conversation Stream + Context Map stay in sync
- Branch / Re-Branch / Promote, custom mainline start/end
- Context controls: per-node include/exclude and batch operations
- Structure governance: Undo / Redo, Reset to Natural
- Layouts: Canvas / Map / Thread
- AI: streaming chat, branch summary, pattern / SOP extraction fields (
name/ guidance / steps)
React 19 · TypeScript · Vite · Zustand · @xyflow/react + Dagre · Tailwind CSS 4 · OpenAI-compatible chat API (see .env.example)
erDiagram
CHAT_HISTORY {
text message_id PK
text user_id
text project_id
text parent_id
text branch_id
}
PATTERNS {
text pattern_id PK
text user_id
text source_from_node_id
text source_to_node_id
text created_from_project_id
}
BRANCH_FEEDBACK {
text sample_id PK
text user_id
}
STRUCTURE_SUGGESTION_FEEDBACK {
text event_id PK
text suggestion_id
text user_id
text project_id
text target_node_id
}
CHAT_HISTORY ||--o{ CHAT_HISTORY : "parent_id -> message_id"
CHAT_HISTORY ||--o{ PATTERNS : "source_from_node_id/source_to_node_id -> message_id"
CHAT_HISTORY ||--o{ STRUCTURE_SUGGESTION_FEEDBACK : "target_node_id -> message_id"
CHAT_HISTORY ||--o{ BRANCH_FEEDBACK : "user_id (logical)"
Full rigorous version (constraints, indexes, and FK hardening recommendations): docs/erd.md
| Doc | Purpose |
|---|---|
| docs/deployment.md | Env vars, providers, Vercel, vercel dev |
| docs/supabase.md | Optional Supabase tables for sync / study logging |
| docs/erd.md | Full ERD, keys, logical relations, and FK hardening recommendations |
| CONTRIBUTING.md | How to contribute |
| CODE_OF_CONDUCT.md | Community expectations |
| SECURITY.md | Reporting security issues |
| sdk/README.md | SDK workspace for embedding capabilities |
Today: MVP loop is usable end-to-end (mainline/branches, context controls, rollback, pattern extraction). Regression script: scripts/test-mainline-endpoints.ts.
On the roadmap (non-exhaustive):
- Multi-user collaboration, richer persistence, observability, enterprise-style deployment
- Continual learning: turn accept/reject (and related) structure-level signals into training supervision
- Inference integration: explore wiring the Context Map with KV cache-aware serving
- OpenCode: explore porting this interaction model into OpenCode-style coding workflows
If Contextify or the Mixed-Initiative Context idea helps your work, please cite:
@article{li2026mixed,
title={Mixed-Initiative Context: Structuring and Managing Context for Human-AI Collaboration},
author={Li, Haichang and Zhang, Qinshi and Wang, Piaohong and Lu, Zhicong},
journal={arXiv preprint arXiv:2604.07121},
year={2026}
}Attribution and citation policy:
- Keep
NOTICEin redistributions and derivative works (Apache-2.0 notice flow). - For academic/research use of this project or concept, cite the paper above.
Issues and PRs are welcome. Start with CONTRIBUTING.md.
Apache-2.0. See also NOTICE and CITATION.cff.

