Open source · MIT · Local-first

The framework for building stateful agents

Your agent is a folder: instructions, connections, secrets, workflows. Served over MCP, used from Claude Code, Claude Desktop, Codex, or Cursor.

View on GitHub
Quickstart

Init, serve, attach

gcontext ships no chat loop and no LLM client. The runtime you attach does the reasoning; gcontext keeps the state.

01
Init

Scaffold the state folder. Plain files, ready to edit and version with git.

terminal
$ gcontext init my-agent
Created my-agent/
gcontext.yaml
instructions.md
secrets.env (gitignored)
connections/ modules/ flows/
02
Serve

One local HTTP server exposes the folder over MCP. Clients are logged as they connect. Ctrl+C disconnects everything.

terminal
$ gcontext up my-agent
Serving my-agent at http://127.0.0.1:4242/mcp
+ claude-code connected
03
Attach

Connect a client once, from any directory. gcontext connect prints the exact steps for claude, desktop, codex, and cursor.

terminal
$ claude mcp add --transport http my-agent \
$ http://127.0.0.1:4242/mcp
Added HTTP MCP server my-agent
The state

The agent is a folder

Markdown holds the context, YAML holds the config. You build it, you version it with git, it's yours. Edit any file with a text editor; the server reads on demand, so changes apply immediately.

my-agent/
gcontext.yamlname, description, optional port
instructions.mdstanding instructions for whatever runtime attaches
secrets.envsecret values, gitignored
connections/stripe/connection.yaml declares secret names and deps, index.md holds API notes
modules/accumulated knowledge
flows/multi-step work, tracked as files
archive/excluded from scanning, still readable

Connected clients get six tools: overview, read_context, write_context, run_script, list_connections, flows.

Mechanisms

Three mechanisms, all files

Context ledger

gcontext context lists every channel through which context reaches the agent: loaded, on demand, skipped, or uncontrolled. gcontext only inserts context through the channels on that list. Nothing reaches the agent invisibly.

instructions.mdloaded
modules/on demand
connections/on demand
memory flagskipped
runtime system promptuncontrolled
Secrets

The agent sees secret names; secrets.env holds the values. On run_script, values are injected as environment variables and scrubbed from the output. write_context refuses to touch secrets.env.

# connection.yaml
secrets:
- STRIPE_API_KEY
# the agent uses the name,
# never reads the value
Flows

Steps declare the files they need and produce. Status is computed from the filesystem, like make. There is no engine and no stored run state: completing a step is writing the files it declares.

steps:
- id: draft
needs: [brief.md]
produces: [draft.md]
blockedreadystaledone

Build your first agent

One install, one folder, one server. The rest is files.

View on GitHub