Coplan
Engineering design doc review, purpose-built for AI-assisted planning. Built with Rails 8, Hotwire, and a semantic operations API.
Why Coplan?
Plans get better when more eyes see them. An engineer drafts a plan — often with AI help — and Coplan gives it a home where teammates can review it, leave inline feedback, and iterate. Domain experts catch things the author missed. AI agents respond to feedback and apply edits automatically. The result is higher-quality plans before a single line of code is written.
The editing model is intentionally asymmetric: humans comment, AI agents edit. When a reviewer leaves feedback and the author accepts it, an agent applies the change — creating a new immutable version with full provenance (who changed what, why, and which comment triggered it). This keeps the version history clean and auditable.
How It Works
- Plans are Markdown documents that move through a lifecycle:
brainstorm → considering → developing → live (or → abandoned). Brainstorm plans are private; once a plan moves to considering, it's published to the whole org.
- Inline commenting — select any text in the rendered plan to leave a comment, Google Docs-style. Comments are threaded and anchor to the selected text.
- AI agents edit via semantic operations —
replace_exact, insert_under_heading, delete_paragraph_containing — not brittle line numbers. Agents acquire an edit lease (one at a time), submit operations against a base revision, and the server creates a new version.
- Cloud Personas — server-side AI reviewers (security, scalability, routing) that automatically review plans when they reach certain statuses, or on demand.
- Realtime — comments, edits, and status changes broadcast instantly to all viewers via Turbo Streams.
- Full provenance — every version records the actor (human, local agent, or cloud persona), the AI model used, the prompt, and which comments triggered the change.
Tech Stack
- Ruby on Rails 8+ — importmaps, Hotwire, Stimulus
- MySQL 8+ — UUID primary keys
- SolidQueue — background jobs
- SolidCable — ActionCable adapter
Installation
Add to your Gemfile:
gem "coplan-engine", require: "coplan"
See the Host App Integration Guide for full setup instructions.
Optional integrations
coplan-slack adds signed Slack Events API handling and rich link unfurls without coupling Slack to the core engine.
Development Setup
bin/setup --skip-server
bin/dev
Setup installs the shared, idempotent demo library. Sign in as
hampton@example.com (no password in this example host), then open
Demo library. It links to
presentations, architecture diagrams, tables, code, and named review scenarios.
Use alex@example.com for an approver/admin or noura@example.com for a
security approver.
To add missing examples to an existing development database:
bin/rails coplan:demo:seed
The demo ships with the engine gem. It is separate from coplan:seed, which
installs only required reference data and is safe in production. See the
demo library guide for scenarios, custom ports, and how
to add examples. Re-seeding preserves document content, titles, approvals,
and discussion state; use a fresh database when you need the initial states.
For microphone dictation, start bin/dev from a shell with OPENAI_API_KEY
set, or configure openai.api_key in Rails credentials. Both the plan microphone
and the composer’s Dictate button then record audio for server transcription.
If you add the key after starting the server, restart it and reload the plan.
Without a key, dictation uses the browser’s speech service, which may be unavailable
in embedded browsers. Check configuration without printing the key:
bin/rails runner 'puts Coplan::Ai.available?'
Tests
bundle exec rspec
Run the full local checks in parallel with bin/ci. It uses isolated databases
and a CPU-based worker count; use bin/ci --jobs 12 --browser-jobs 6 to choose
your own limits. See the CI guide for setup, reports, and options.
See CONTRIBUTING.md for pull request, spec, and visual testing requirements.
Interactive features are tested with JavaScript-enabled browser specs in spec/system/.
API
Agents authenticate with Authorization: Bearer <token>. Key endpoints:
GET /api/v1/plans/:id — read a plan
POST /api/v1/plans/:id/lease — acquire edit lease
POST /api/v1/plans/:id/operations — apply semantic edits
POST /api/v1/plans/:id/comments — comment on a plan
See docs/PLAN.md for full architecture.
Project Resources