PugBase/Docs

Import an existing project

Bring a codebase you already have into PugBase, instead of planning from scratch.

Any language, any stack

TypeScript / JSGoPythonJava / KotlinRustC# / .NETRubyPHPFlutter / DartC / C++...

The prompt does not assume a language. It tells the agent to survey whatever is there - the manifest of every stack (package.json, go.mod, Cargo.toml, pyproject, pom, csproj, Gemfile, pubspec, Makefile, ...), the entrypoints, the routes, the schema - so a Go service, a Flutter app and a Python monorepo all come out as the same set of notes.

1

Run the import

Open your project in the coding agent, then paste the prompt below. The agent reads the code and writes the notes itself - no code changes, documentation only. Claude Code installation

Already have a project?

Let the coding agent already in your repo (Claude Code / Cursor) read the code and mirror the real project into a PugBase Planning session over MCP - so your team can read and track it, and Plan with AI can add features on top.

You do not need to read this - just copy and paste it.
Read THIS codebase and mirror it into PugBase as a "Planning" session so my team can read and track the project. Do not change any code - this is documentation only.

Before anything else, TWO checks - and if either fails, STOP and tell me instead of improvising:
- The PugBase MCP tools must actually be available to you (you can see tools like create_note and list_notes). If you cannot see them, the PugBase MCP server is not connected: stop, do NOT pretend to import, and tell me to connect it first (PugBase -> Settings -> Developer).
- The target workspace must be certain. If your PugBase connection is scoped to one workspace, use it. If you can see MORE than one workspace (or more than one PugBase server is connected), list them and ask me which one BEFORE creating any note - an import into the wrong workspace is worse than no import.

If this is a LARGE repo or a monorepo (many packages/services), do not silently survey everything: tell me what you found at the top level and ask which systems matter most, then go deep on those first.

Steps:
1. Survey the repo IN THIS ORDER, whatever the language - the artifacts below exist in every stack under some name:
   a. List the folder tree 2-3 levels deep to see the shape of the project.
   b. Read every manifest / build file (package.json, go.mod, Cargo.toml, pyproject, pom, csproj, Gemfile, pubspec, Makefile, ...) for dependencies and scripts.
   c. Find the entry points and how each system STARTS and how its tests run - the exact commands.
   d. Read the schema: migrations, ORM models, or collection definitions.
   e. Read routes/handlers/events, config + .env.example, CI and deploy files, then any README / docs.
2. Create these notes in the "Planning" session (use create_note with session "Planning" and the folder shown). A [[link]] only becomes a real link when its target note already exists, so create the content notes first and AGENTS.md LAST:
   - Overview (folder "Requirements"): the goal, in/out of scope, and a "## Systems & architecture" section listing each system/service with its real stack and how they connect.
   - Constraints (folder "Requirements"): the binding decisions the code ALREADY follows - the stack per system, architecture pattern + folder layout, auth/session approach, error shape, naming conventions, and hard limits. Describe what IS, not what should be. MUST include, per system, one line each: 'Run: `<the exact start command>`' and 'Test: `<the exact test command>`' - tooling reads the Run line to start the project, so get it exactly right.
   - Config & Environment (folder "Requirements"): a table of every env var / config key - name, required or optional, what it does, where it is read. Mark secrets as <secret>; never paste real values.
   - Data Model (folder "Diagrams"): for a SQL database you MUST use the create_diagram_note tool with kind "erd" and DBML code of the real tables - a live editable canvas, never a ```dbml``` block in a doc note. For NoSQL use a regular create_note with the real collections + document shapes. Base it on the actual schema/migrations, not a guess.
   - API Contract (folder "Requirements", ONLY if the project exposes an API/events): for an HTTP API use create_api_note with a COMPLETE OpenAPI 3 YAML of the real endpoints - request/response schemas, worked example values, error responses, tags per resource, and the auth scheme; it renders as a Swagger-style reference. For non-HTTP contracts (events, CLI, library interfaces) use a regular create_note describing each one.
   - Architecture (folder "Diagrams"): you MUST use the create_diagram_note tool with kind "flowchart" and Mermaid code of the real systems and how they connect (subgraph zones per service, @logos:<tech> icons for concrete technologies, labels ONE short line - never 
 or <br> inside a label). NEVER put an architecture or flow diagram in a mermaid code block inside a doc note - the canvas lays out zones and renders real icons; a code block renders flat with icon syntax as raw text.
   - Key Flows (folder "Diagrams", only if the project has nontrivial runtime flows): 1-3 ```mermaid``` sequenceDiagram blocks in a REGULAR note (create_note) for the flows that matter most (the main user action, auth, anything with a queue or webhook) - actors, calls, and what can fail. Sequence diagrams are the ONE kind that stays as a mermaid block: the canvas has no sequence mode, and the mermaid renderer is the accurate one for them.
3. Split what EXISTS from what is OWED - they are different documents:
   - Built Features (folder "Requirements"): the inventory of what the code already does, grouped under "## <Feature>" headings as PLAIN bullet lists - no checkboxes. Nobody in this workspace did this work, so it must not read as progress on the board.
   - Backlog notes (folder "Backlog", NOT "Tasks"), one per system/discipline that exists, titled "Backlog - <System>": ONLY the open items - known TODOs, gaps, tech debt you can see in the code - as unchecked `- [ ]` lines with a short "(why)" each. Sweep the runtime concerns too, not just the code comments: error handling gaps, missing tests, hardcoded secrets/config, unpaginated queries, absent monitoring, dependency rot - each only if actually present. This is reference, not the plan: the board lists it without counting it. Leave the "Tasks" folder alone - it belongs to work this workspace plans itself.
4. Now that every note exists, create AGENTS.md (no folder): first line "# Project: <the real project name>", then - if this repo has a git remote - one line 'Repository: <host>/<owner>/<name>' (from `git remote get-url origin`, stripped of protocol, credentials and trailing .git; skip the line entirely if there is no remote), then a short paragraph on what it is, then a "## Read in this order" section: a NUMBERED LIST (never a table - [[links]] inside table cells do not render), one line per note as "[[Note Title]] - what it answers", ordered the way a newcomer should read them (Overview first, then Constraints, then the rest). The folder argument on create_note is where a note FILES, not something to write notes about.
5. Cross-link the notes: whenever one note mentions an endpoint, entity, or decision defined in another, write [[That Note Title]] at first mention. A link to a note created LATER degrades to plain text - when a cross-link matters, add it with update_note after both notes exist.
6. Keep every note SKIMMABLE: headings, tables for structured data, fenced code blocks for schema/config/payloads. No walls of bullets. Use only keyboard characters in note text: write "->" not an arrow glyph, "-" not an em-dash, "..." not an ellipsis character.

Be accurate to the code as it exists now. When something is genuinely unclear from the code, note it as an open item in a "Risks" note (folder "Other") rather than guessing.

Paste this into the coding agent's terminal, opened inside your project (connect the PugBase MCP first - see Developer settings).

your-project - Claude Code
>claude
~/your-project (main)
>Read this repository and import it into PugBase: create the Planning notes...
Reading go.mod, main.go, routers/, models/ ...
AGENTS.md - project router written
Overview / Constraints / Data Model / API Contract
Architecture diagram (5 zones, 14 nodes)
Tasks: Articles (12 done), Users (9 done), Backlog - Backend (4 open)
Import complete - open the workspace's Status page to see the board.

In your IDE: paste the prompt into the coding agent opened inside the project. It reads, then writes notes over MCP - your code is never changed.

2

What it produces

A Planning session mirroring the real project: an AGENTS.md router, Overview / Constraints / Data Model / API Contract, an Architecture diagram, and per-system Tasks notes where already-built work is checked off and gaps are left as TODOs. The Status view and knowledge graph light up from it automatically.

The Architecture diagram it draws from the real code - zones per service, real technology icons.
Every HTTP endpoint lands in an editable API Contract note, grouped Swagger-style.
The Status board after an import: systems, progress, backlog and (if bound later) pull requests - one page a stakeholder can read.
3

Just want docs? Skip the plan

For a handoff or a team reference, paste the prompt below instead of the plan one. The agent documents the codebase into a "Docs" session - Start Here, Run & Deploy, Config, Conventions, Data Model, API Reference, Architecture, Known Gaps - grouped in iconed folders, with no tasks and nothing that reads as progress. Publish the session as a docs site and the team reads it anywhere.

You do not need to read this - just copy and paste it.
Read THIS codebase and document it into PugBase as a "Docs" session so my team can read, onboard and hand off the project. This is DOCUMENTATION ONLY: do not change any code, and do not create tasks, plans, backlogs or anything with checkboxes - these notes describe what IS, they are not a to-do list.

Before anything else, TWO checks - and if either fails, STOP and tell me instead of improvising:
- The PugBase MCP tools must actually be available to you (you can see tools like create_note and list_notes). If you cannot see them, the PugBase MCP server is not connected: stop, do NOT pretend to work, and tell me to connect it first (PugBase -> Settings -> Developer).
- The target workspace must be certain. If your PugBase connection is scoped to one workspace, use it. If you can see MORE than one workspace (or more than one PugBase server is connected), list them and ask me which one BEFORE creating any note.

If this is a LARGE repo or a monorepo (many packages/services), do not silently survey everything: tell me what you found at the top level and ask which systems matter most, then go deep on those first.

SEVERAL REPOS IN ONE FOLDER: your working directory may be a PARENT folder holding one folder per repo (e.g. shop/{shop-web, shop-api, shop-admin}), each with its own .git - a very common shape for a product split across repos. Detect it BEFORE surveying: if the top level has no manifest of its own but its subfolders each carry a .git plus their own manifest, treat EACH as a separate repo, not as packages of one project (a monorepo has ONE .git at the top and shared tooling - say which of the two you found). Then: survey each repo in turn, name the repo on every note that describes its code (a "**Repo:** <folder name>" line under the title), and give Overview a "## Repos" table - | Repo | What it is | Stack | Runs on | - so a reader knows which checkout a file path belongs to. Cross-repo calls (web calling api) belong in the Architecture diagram with each system in its own zone. If PugBase reports declared repos for this workspace, use THOSE names verbatim.

Steps:
1. Survey the repo IN THIS ORDER, whatever the language - the artifacts below exist in every stack under some name:
   a. List the folder tree 2-3 levels deep to see the shape of the project (and, in a multi-repo folder, do this per repo).
   b. Read every manifest / build file (package.json, go.mod, Cargo.toml, pyproject, pom, csproj, Gemfile, pubspec, Makefile, ...) for dependencies and scripts.
   c. Find the entry points and how each system STARTS and how its tests run - the exact commands.
   d. Read the schema: migrations, ORM models, or collection definitions.
   e. Read routes/handlers/events, config + .env.example, CI and deploy files, then any README / docs.
2. Create EXACTLY these notes, with EXACTLY these titles, in the "Docs" session. Titles are a contract: teammates and tools look these notes up BY NAME, so do not rename, merge or restructure them - a small project gets the same set with shorter notes, never fewer notes. Skip a note ONLY when the project truly has none of that thing (no API, no database), and then say so in "Start Here" ("no Data Model - the service keeps no state"). File each note in the FOLDER shown and pass the ICON shown (icon + folderIcon args) so the sidebar reads at a glance. A [[link]] only becomes a real link when its target note already exists, so create the content notes first and the index LAST:
   - Overview (no folder, icon "🧭"): what the project is and does, who uses it, and a "## Systems & architecture" section listing each system/service with its real stack and how they connect.
   - Run & Deploy (folder "Setup", folderIcon "🚀", icon "▶"): per system, the EXACT commands - 'Run: `<start command>`', 'Test: `<test command>`', build and deploy steps, and where it runs in production. A new teammate should go from clone to running using only this note. Every URL/port you print must be the one THAT START COMMAND actually serves - resolve it from the launch profile / config the command uses (e.g. `dotnet run` uses the first "Project" profile in launchSettings.json; an IIS Express port belongs to Visual Studio, not to `dotnet run`).
   - Config & Environment (folder "Setup", icon "🔑"): a table of every env var / config key - name, required or optional, what it does, where it is read. Mark secrets as <secret>; never paste real values.
   - Features (folder "Reference", folderIcon "📚", icon "💡"): what the product actually DOES, feature by feature - a table with: feature, what it does in one plain sentence, who uses it (end user / admin / other services), the entry-point file(s), and the main classes/services/entities behind it. This is the note that answers "what am I even looking at" - write it from the routes/screens/handlers that exist, not from the README's ambitions.
   - Code Map (folder "Reference", icon "🗺"): the guided tour of the code for someone who has NEVER worked in this stack - per top-level project/package: one intro sentence, then a TABLE of its sub-folders (folder | what lives there | key types), then its dependency rule as a ```callout-info ("may depend on X, must NOT depend on Y - and why, when the code enforces a direction"). After the projects: ONE real request/operation traced end to end as a NUMBERED list naming the actual files and classes ("browser hits /basket -> src/Web/Controllers/... -> ..."), and a "to add or change X, you will touch these files" section as a table for the 2-3 most common kinds of change.
   - Conventions (folder "Reference", icon "📏"): the decisions the code already follows - architecture pattern + folder layout, auth/session approach, error shape, naming conventions, hard limits. Describe what IS, not what should be.
   - Data Model (folder "Reference", icon "🗄"): for a SQL database you MUST use the create_diagram_note tool with kind "erd" and DBML code of the real tables - it renders as a live tables-and-relations canvas the team can edit; a ```dbml``` code block in a doc note renders flat and dead. For NoSQL use a regular create_note with the real collections + document shapes. Base it on the actual schema/migrations, not a guess.
   - API Reference (folder "Reference", icon "🔌"; ONLY if the project exposes an API/events): for an HTTP API you MUST use the create_api_note tool - never create_note - with a COMPLETE OpenAPI 3 YAML of the real endpoints: request/response schemas, worked example values, error responses, tags per resource, and the auth scheme. It renders as a Swagger-style reference the team can edit endpoint-by-endpoint; a markdown API note cannot. For non-HTTP contracts (events, CLI, library interfaces) use a regular create_note describing each one.
   - Architecture (folder "Diagrams", folderIcon "📊", icon "🏗"): you MUST use the create_diagram_note tool with kind "flowchart" and Mermaid code of the real systems and how they connect (subgraph zones per service, @logos:<tech> icons for concrete technologies (cloud PRODUCTS use their product set instead: gcp:<product> for GCP - e.g. gcp:google-kubernetes-engine, gcp:artifact-registry - and logos:aws-<service> for AWS), labels ONE short line). NEVER put an architecture or flow diagram in a mermaid code block inside a doc note - the diagram canvas lays out zones and renders real icons and stays editable; a code block renders it flat with the icon syntax showing as raw text.
   - Code Architecture (folder "Diagrams", icon "🧩"): you MUST use the create_diagram_note tool with kind "flowchart" - the inside-the-code companion to Architecture (which stays at the system level). One zone (subgraph) per layer or top-level module, nodes at COMPONENT granularity (a group of files with one job: "Razor Pages", "MediatR handlers", "IRepository<T>", "EF DbContexts") - NEVER one node per class, stop before the diagram needs more than ~15 nodes. Every edge is a real call or dependency that exists in the code, labeled with its mechanism ("DI interface", "MediatR", "HTTP + JWT", "props") - and every edge connects two component NODES, not two subgraph ids (zone-level edges exist on the canvas, but "which component in A calls which component in B" is exactly the information THIS diagram carries), so pick the concrete pair (the HTTP client node to the endpoint node, the repository node to the DbContext node). First identify the pattern the code ACTUALLY follows - MVC, MVVM, Clean/Onion, Hexagonal (ports and adapters), layered n-tier, feature-sliced / feature-based (common in React), event-driven, plain scripts - name it in the diagram title node and let the zones mirror that pattern's own vocabulary. Judge the pattern from imports and folder structure, not from what the README claims; if the code follows no named pattern, diagram the real structure and say "no formal pattern" instead of forcing a label.
   - Key Flows (folder "Diagrams", icon "🔁"; only if the project has nontrivial runtime flows): 1-3 ```mermaid``` sequenceDiagram blocks in a REGULAR note (create_note) for the flows that matter most - actors, calls, and what can fail. Sequence diagrams are the ONE kind that stays as a mermaid block: the canvas has no sequence mode, and the mermaid renderer is the accurate one for them.
   - Known Gaps (folder "Reference", icon "⚠"): TODOs, tech debt and sharp edges you can SEE in the code. Each gap is its OWN callout block - ```callout-error for security holes (hardcoded secrets, auth bypasses), ```callout-warning for everything else - first line a bold title, then what/where, then "Why it matters: ...". Never checkboxes - this is a warning label, not a work list.
3. Now that every note exists, create the index note titled "Start Here" (session "Docs", NO folder, icon "👋") - this note is NOT optional, it is the front door: first line "# <the real project name>", a short paragraph on what it is, then a "## Read in this order" NUMBERED LIST (never a table), one line per note as "[[Note Title]] - what it answers", ordered the way a new teammate should read them, plus one line per SKIPPED note saying why it does not exist here.
4. Cross-link: whenever one note mentions an endpoint, entity, or decision defined in another, write [[That Note Title]] at first mention.
5. Keep every note SKIMMABLE - these notes render as RICH BLOCKS, so use the block that carries the meaning instead of prose:
   - Any list where every item has the same fields (endpoints, env vars, folders, features) is a markdown TABLE, never bullets.
   - Any warning, hard rule, or gotcha is a ```callout-warning / ```callout-error fence; any "good to know" aside is ```callout-info or ```callout-tip. The fence body is plain markdown.
   - Commands, schema, config and payloads are fenced code blocks with the right language tag.
   - More than 5 consecutive plain bullets or a paragraph over ~5 lines means you picked the wrong block - restructure.
   Use only keyboard characters: "->" not an arrow glyph, "-" not an em-dash, "..." not an ellipsis character.
6. Write for a reader who has never used this stack: the FIRST time a stack-specific concept appears in a note (DbContext, goroutine, Blazor, middleware, ...), add a plain-words gloss in the same sentence ("AppIdentityDbContext (the class through which EF Core talks to the identity database)"). Once per note is enough - do not re-explain on every mention.

Be accurate to the code as it exists now. When something is genuinely unclear from the code, say so in the note ("unclear from code: ...") rather than guessing.

To keep the docs current: after a code change, paste this short prompt - or tell your agent "update the api docs in PugBase" in your own words. The full procedure ships with the MCP server, so the agent diffs the docs against the code and updates only what changed.

You do not need to read this - just copy and paste it.
Update the PugBase "Docs" session for this repo so it matches the code as it is now. Documentation only - do not change any code. The PugBase MCP server's instructions carry the full procedure; follow them, and tell me exactly which notes changed - or that everything was already in sync. If you cannot see the PugBase tools, STOP and tell me to connect the MCP server instead of improvising.

The second prompt keeps the docs current: after a code change, paste it and the agent updates only the notes that changed - and reports when everything is already in sync.

What a docs-only import produces: the Start Here front door, honest notes about what was skipped and why, and the doc set grouped in the sidebar.
4

Plan a NEW feature from the code

Once a codebase is in front of your agent, planning the next feature works the same way: paste this prompt, state the feature, and the agent surveys the real files first - so the plan's constraints and tasks cite the routes, entities and conventions your repo actually has, instead of guessing the architecture.

You do not need to read this - just copy and paste it.
You are inside the codebase this feature will be built INTO. Plan it in PugBase - do NOT write or change any code in this repo. If I have not told you what the feature is, ask me first.

If the PugBase MCP tools (plan_clarify, create_plan) are not visible to you, STOP and tell me to connect the PugBase MCP server instead of improvising.

Steps, in order:
1. SURVEY the parts of this codebase the feature will touch. Read the real files: entry points, routing, the closest existing feature to copy patterns from, entities/models, migrations, auth, tests. Collect REAL paths - you will cite them.
2. Call plan_clarify with the feature as the idea. Answer its questions YOURSELF wherever the CODE already decides the answer (stack, auth model, db, conventions) - each such answer must cite the deciding file. Ask ME only what the code genuinely cannot decide. Loop (pass all answers back) until done:true.
3. Call create_plan with:
   - idea: the feature, one concrete paragraph.
   - context: EVERYTHING that grounds the plan in this repo - the Q/A pairs from step 2, plus a "Codebase facts:" section: the real file paths per area (where routes live, where entities live, where migrations live, the existing feature to mirror, auth mechanism, test setup), and the conventions the plan's tasks must follow.
   Every EXISTING path you cite must be one you actually opened or listed - never from memory. A NEW file's path must mirror the layout of its closest existing sibling and be marked (new).
4. create_plan takes 3-8 minutes. If the call times out on your side, the server keeps generating: do NOT call create_plan again - poll plan_status every ~30s until it reports done.
5. Report the created notes and one line on which existing feature you mirrored.

After the first time you can skip the paste: with the PugBase MCP server connected, "plan adding <feature>" in your agent is enough - the server's instructions carry this procedure.

5

Then add features on top

Once the project lives in PugBase, Plan with AI reads that context: it plans new features against your existing stack and decisions, and skips interview questions the docs already answer - instead of treating every plan as a blank slate.

PugBase x Claude Code - plan it in PugBase, build it with Claude, review it together.