Developing with agents: the CLI and your coding agent
This guide is for developers who want to build and iterate on GraphN workflows and agents using the terminal and AI coding assistants—not only the web UI.
You will learn how to:
Install and configure the GraphN CLI
Bootstrap Cursor, Claude Code, Codex, and AGENTS.md with project rules and optional MCP
Command names:graphn workflow and graphn wf are the same command; graphn blueprint and graphn bp are the same command. Examples below use the long form.
This opens your default browser, authenticates via Google or GitHub, and stores a session token locally. Your workspace is selected automatically.
Or: API key
If you prefer API keys (e.g. for CI or shared environments):
In the GraphN web app, open your workspace Settings → API Keys (or click the API Keys button in the header) and create a key.
Run the interactive setup:
bash
graphn init --setup-only
This stores your API base URL (for production, typically https://cp.graphn.ai), API key, and default workspace ID in the CLI config.
Verify connectivity
bash
graphn whoamigraphn config show
You can override config with environment variables (useful in CI):
Scroll horizontally to compare
Variable
Purpose
GRAPHN_API_KEY
API key
GRAPHN_URL
API base URL
GRAPHN_WORKSPACE
Workspace ID
GRAPHN_GATEWAY_URL
Required for graphn workflow run (production execution through the gateway)
3. Bootstrap your repo for AI assistants (graphn init)
Running graphn init (without --setup-only) creates files that teach your coding agent how to use the GraphN CLI when it works in your repository. Four targets are supported:
The agents target covers every tool that reads the cross-agent AGENTS.md convention — Zed, OpenCode, Amp, Roo Code, and GitHub Copilot among them — so those tools are supported without needing an entry of their own. Gemini CLI reads GEMINI.md by default, so it only picks up AGENTS.md if you add it to context.fileName in .gemini/settings.json.
codex and agents share the AGENTS.md writer, so selecting both writes the file once.
Every path is written inside your project — no agent configuration goes to ~/.codex, ~/.claude, or ~/.cursor, so everything graphn init changes about your agent setup shows up in git status and git checkout undoes it. CLAUDE.md, AGENTS.md, and .codex/config.toml are yours as well as GraphN's, so only the region between the graphn:start and graphn:end markers is rewritten; anything outside them is copied through untouched.
Codex trust prompt: because .codex/config.toml is project-scoped rather than global, Codex only loads it for directories you have trusted and prompts the first time you run codex in the project. Until you accept, the GraphN MCP server will not appear under /mcp.
Choosing agents
By default graphn init configures Cursor and Claude Code, plus any other agent this directory already shows evidence of. Use --agent to choose explicitly:
bash
graphn init # Cursor + Claude Code, plus any agent detected heregraphn init --agent codex # one agentgraphn init --agent cursor,codex # several (repeatable or comma-separated)graphn init --agent all # every supported agentgraphn init --agent auto # only agents this directory shows evidence of
Values are case-insensitive, deduplicated, and always applied in registry order, so --agent codex,cursor and --agent cursor,codex write the same files. An unrecognized value is an error rather than a silent no-op, and --agent auto fails in a directory with no coding agent in it.
Other flags:
--setup-only — only API/workspace setup; no rule files.
--skills-only — only create/update rule files; no setup wizard.
--cursor-only / --claude-only — deprecated aliases for --agent cursor / --agent claude. They still work, but cannot be combined with --agent.
After graphn init, your coding agent can suggest commands like graphn workflow dry-run, graphn agent update, and graphn blueprint deploy with the right context.
4. Embedded skills and documentation (graphn docs)
The CLI ships focused guides you can read in the terminal (no browser required):
graphn docs dsl
graphn docs api
graphn docs helpers
graphn docs all
Relationship to “skills” in your editor: GraphN’s graphn docs skills … are built-in documentation topics bundled with the CLI. Separately, you can add your own agent skills in your repo (for example Cursor Agent Skills in .cursor/skills/your-skill/SKILL.md) for your team’s conventions. They work together: your skills describe your process; graphn docs describes GraphN’s workflows and APIs.
5. Expose the CLI to the IDE via MCP (graphn mcp-serve)
Model Context Protocol (MCP) lets a coding agent call external tools. GraphN can expose all CLI commands as MCP tools so the agent can list workflows, run dry-runs, or update agents without you pasting shell output.
Start the server on stdio (the IDE spawns it):
bash
graphn mcp-serve
graphn init already registers this server for Cursor, Claude Code, and Codex. The formats below are what it writes, for when you would rather configure it by hand.
Cursor — add to .cursor/mcp.json (create the file if needed):
Codex loads project config only for directories you have trusted, so the server appears under /mcp after you accept the trust prompt on your first codex run in the project.
Other MCP-capable agents take the same command and args in whichever config file they read.
Ensure graphn is on your PATH where the IDE runs. After connecting, the coding agent can invoke GraphN operations as structured tools (exact tool list depends on CLI version; use graphn --tool-schema for machine-readable command metadata if you automate).
6. A practical development loop
Typical flow when changing a workflow or agent:
Inspect workspace state
bash
graphn context
graphn workflow list
Edit — In the UI, or locally: export a bundle or DSL if your team uses repo-backed YAML, then push changes to the API:
graphn config set-gateway-url https://your-gateway-base
graphn workflow run <workflow-id-or-name> --input-file ./input.json
Use -f text for human-readable tables and -v to print HTTP traces when debugging.
7. Blueprints from the CLI
List and deploy templates without opening the app:
bash
graphn blueprint list
graphn blueprint info kb-ingestion
graphn blueprint deploy kb-ingestion --name"My Company KB Search"
Blueprint IDs and names change over time; always use graphn blueprint list as the source of truth.
8. When you need more than the default templates
The Company Knowledge Search blueprint gives you: storage → OCR → KB ingest → Researcher (RAG) → Synthesizer. That is the right shape for document-grounded analysis, but the default prompts and tools are generic (for example, a single semantic_search tool and general Q&A instructions).
To match a strict domain workflow—such as extracting every shall / must into a compliance matrix with UCF sections—you typically need to:
Extend MCP tools (e.g. keyword search, document listing, bounded full-text read) where the product supports them.
Rewrite Researcher and Synthesizer instructions for your output schema (tables, columns, evidence quotes).
Run dry-runs on real contracts and iterate until stakeholders sign off.
See the Document analysis tutorial for the edit agents and prompts pattern in the UI. The same resources can be updated from the terminal (graphn agent update …, graphn mcp-server update …; mcp-server and mcp are the same command).
9. Telemetry
The CLI collects anonymous telemetry to help us diagnose crashes and improve performance. Telemetry is on by default and can be disabled at any time.
What is collected:
Command name, error messages, and CLI arguments
Workspace ID, org ID, and API URL
Request bodies (for debugging failed API calls)
CLI version, OS, and architecture
Anonymous device ID (random UUID, not tied to your account)
What is never sent: API keys and bearer tokens are always redacted before any data leaves your machine.
Sampling rates:
Scroll horizontally to compare
Event type
Sample rate
Errors (crashes and failed commands)
100% — every error is reported
Performance traces (successful commands)
20%
Local crash log: Regardless of telemetry settings, errors are always written to ~/.graphn/crash.log (local-only, never sent remotely). The log rotates at 1 MB.
Opt out:
bash
# Disable permanentlygraphn telemetry disable
# Disable for a single sessionGRAPHN_TELEMETRY_DISABLED=1 graphn <command># Re-enablegraphn telemetry enable# Check current statusgraphn telemetry status
You are also prompted to opt out during graphn init.
Re-run graphn init --setup-only; check API key and workspace ID. If you recently changed the CP URL, the API key may belong to a different environment — run graphn config set-key <new_key> and graphn whoami to confirm.
graphn workflow publish "My Workflow" not found
Use the workflow ID (wf_…) from graphn workflow list.
workflow run says gateway required
Set GRAPHN_GATEWAY_URL or graphn config set-gateway-url.
MCP tools not appearing
Confirm graphn mcp-serve runs manually; check IDE MCP config and PATH.
mcp start --wait timed out
This is safe to ignore for dry-run and workflow runs. The runtime starts the server on-demand when the first tool call occurs. Only block on mcp start if you need the server running before external tests.
Dry-run or wf run hangs / client times out
The workflow likely takes over ~2 minutes. Switch to async: graphn workflow run <id> --mode async --input '…', then poll with graphn exec get <exec_id> --watch.
Feature missing after graphn update
Verify with graphn version. The installed binary may lag behind the latest commit; check GitHub Releases for the newest tag.
For deeper debugging, run graphn docs skills debugging. For gateway mode guidance (sync vs async), run graphn docs skills gateway-modes.