Searching Constellation

Type to search Constellation.

Getting started

Install the CLI, scaffold a plan, write and lint your first card, open the viewer, and connect an AI agent over MCP.

This walks through a plan from zero: an empty repo, one command to scaffold it, two cards connected into a graph, and an agent that can read and write them. The examples follow a small support-ticket app, the same one the Constellation package ships as its golden example plan.

1. Install the CLI

npm install -g @magic-spells/constellation
constellation version

Requires Node ≥ 22. Every command below also runs as npx @magic-spells/constellation … if you would rather not install globally.

2. Scaffold a plan

From the root of your repo:

constellation init
# ✓ Created constellation/plan.md
#   Project name: Ticket Desk
# Use working memory on this repo? [Y/n]
# Clear the working memory with every new session? … [y/N]
# ✓ Working memory at …/ticket-desk/.constellation
#   .gitignore: added (check: ok)

constellation init --name "Ticket Desk"   # or name it yourself

init creates a constellation/ folder holding a starter plan.md and sets up working memory. The project name defaults to a title-cased folder name (ticket-desk becomes “Ticket Desk”); pass --name to set your own, or edit the name: field later. The starter plan has three sections to fill in as the project takes shape:

---
name: Ticket Desk
---

# Project Plan

## Current state

- (what exists, what is in flight)

## Conventions

- (project-wide rules cards should follow)

## Last synced

Code has not been reconciled against this plan yet.

plan.md is a card like any other, with the fixed handle PLAN-PROJECT. It is the one every session reads first, so keep it short: what exists, what is in flight, and the rules every other card should follow.

3. What the folder looks like

A plan is a folder of markdown files, one card per file, grouped into one folder per card type:

constellation/
  plan.md                         ← PLAN-PROJECT, the living project plan
  .sync.json                      ← sync marker (written by the tools)
  api/API-TICKETS.md              ← one file per card; the filename IS the handle
  db/DB-TICKETS.md
  datatype/DATATYPE-TICKET.md
  flow/FLOW-CREATE-TICKET.md
  file/FILE-TICKETS-ROUTE.md
  decision/DECISION-NO-HARD-DELETE.md
  • The filename is the handle. api/API-TICKETS.md defines the card API-TICKETS. Handles are uppercase letters, digits and dashes, and the prefix before the first dash is the type.
  • The folder matches the type. An API- card lives in api/, a FILE- card in file/. There are 21 types: API, DB, DATATYPE, FLOW, STATE, PAGE, COMPONENT, FILE, FEATURE, RELEASE, DECISION, DOC and more.
  • Nothing derived is stored. The graph, the backlinks and the change history are computed from the files and from git. The only marker file is .sync.json, which records when the plan was last reconciled with the code.

4. Write your first card

Create constellation/api/API-TICKETS.md:

---
name: List & create tickets
status: building
path: /api/v1/tickets
methods:
  GET:
    query_params:
      - { name: status, type: string }
  POST: {}
connections:
  - FILE-TICKETS-ROUTE
---

# Tickets API

GET lists tickets, filtered by status, for signed-in support agents. POST is
the public intake endpoint: no auth, because customers file tickets from the
help widget without an account.

Tickets are never hard-deleted, so there is no DELETE. Closing a ticket is a
status change. See [[DECISION-NO-HARD-DELETE]].

A card has two halves:

  • Frontmatter is structure. Four keys work on every card: name (the display label), kind (a subtype, when the type has variants), status (planned, building, built or verified) and connections. Everything else is type-specific: an API card has path and methods, a DB card has columns. Never write handle: or type:; the filename already says both.
  • The body is the narrative. Write what the code cannot say: who the endpoint is for, why POST has no auth, why there is no DELETE. Do not paste signatures or DDL that already live in the repo, because copies drift.

Connections come only from frontmatter: the connections: list, plus handle-shaped values in other fields (a response_schema: DATATYPE-TICKET connects on its own). They are undirected, so declare each one once, on whichever card you are editing. A [[HANDLE]] link in the body is a clickable hyperlink for readers, never a graph edge.

5. Lint it

constellation lint

# api/API-TICKETS.md
#   error E005  Reference to FILE-TICKETS-ROUTE does not resolve to a card
#   warn  W004  Body reference [[DECISION-NO-HARD-DELETE]] does not resolve to a card
#
# ✗ 2 cards, 0 connections, 1 errors, 1 warnings

Two problems, two severities. The connections: entry points at a card that does not exist, and a structured reference is a contract, so that is an error and the command exits 1. The body link to DECISION-NO-HARD-DELETE is only a warning: prose may point at a card nobody has written yet, which is how you mark future work.

Add the missing card at constellation/file/FILE-TICKETS-ROUTE.md. A FILE card binds the plan to a real source file; path is relative to the folder that holds constellation/, normally your repo root:

---
name: tickets route handler
status: building
path: src/api/tickets.ts
language: typescript
summary: Express route handlers for the tickets API
---

Validation lives here; persistence is in the repository module it imports.
constellation lint

# api/API-TICKETS.md
#   warn  W004  Body reference [[DECISION-NO-HARD-DELETE]] does not resolve to a card
#
# ✓ 3 cards, 1 connections, 0 errors, 1 warnings

Zero errors, one connection, and the warning stays until the decision card exists. There is no need to list API-TICKETS on the FILE card: the connection declared on the API card is visible from both sides. See CLI commands for what each severity covers.

6. See the graph

constellation serve              # http://localhost:4747
constellation serve --readonly   # browse without editing
constellation serve --dev-origin http://localhost:8080   # view through a forwarded/proxied port

serve renders the plan as a local website at http://localhost:4747 (it walks up to the next free port if that one is busy). Each card page shows its fields, its body, connection chips in both directions and a small diagram of its neighborhood. The plan is editable in place, and the page live-reloads when files change on disk. Pass --readonly to turn editing off.

7. Connect an agent

The MCP server is how an agent reads and writes the plan. In Claude Code, from your repo root:

claude mcp add constellation -- npx -y @magic-spells/constellation mcp

Codex, Claude Desktop and other clients are covered in Add to Claude Code & Codex. The one rule for all of them: the server has to start inside your project, or every tool returns NO_PLAN_FOUND.

Once connected, the agent is self-serving. orient gives it the whole plan at a glance in one small call, and describe_type hands back any type’s fields and a golden example, so it can write correct cards with no extra setup. From here on, let the agent write cards through the server’s tools (create_card, append_note, edit_section and friends) rather than editing files by hand: every write is validated and linted. To also give your agents the authoring skill, run constellation add skills.

8. Starting from an existing codebase

You do not have to write the first fifty cards yourself. The server ships a bootstrap_plan prompt, which Claude Code lists as a slash command:

/mcp__constellation__bootstrap_plan

It tells the agent to create the plan if there is none, then work the codebase macro to micro: follow the data, follow the user and auth journeys, capture flows, diagrams and state machines, and ask you only what the code cannot answer. It finishes with the gaps it found and a short, prioritized list of recommendations. Expect a lean plan rather than one card per file: the aim is the smallest plan that still saves the next agent from rediscovering the why.

Where to go next