This document provides an overview of the key directories in the Gram project to help you understand the codebase organization.
If you've just cloned this repository, then consider running `./zero --agent` to get your development environment set up.Never include customer-identifying information in anything that gets committed or pushed: customer names, organization ids, project ids, external account ids, emails, or revenue/spend figures. This applies to EVERY surface that leaves the machine — branch names, commit messages, PR titles and bodies, file contents, file NAMES, changesets, test fixtures, and code comments. This repository is public, and pushed data propagates to surfaces that cannot be scrubbed afterwards: pull request refs outlive branch deletion, CI logs embed PR titles, and review bots ingest full diffs.
- Use placeholders (
<PROJECT_ID>,<ORG_ID>, "the customer") in runbooks, migrations, docs, and tests — even when hardcoding a real value would be more convenient. Keep concrete values in internal systems (e.g. Linear) and fill them in at execution time. - Ticket ids (e.g. ABC-123) are fine; ticket URLs whose slugs embed a customer name are not.
- Before committing or pushing, check every surface: branch name, commit message, changed file contents and names, changeset text, PR title/body.
/: Root directory of the Gram projectmise.toml: Default environment variables are configured here and support running Gram and its tasks.mise.local.toml: Local environment variable overrides for development. This file is ignored by git and should not be committed..mise-tasks/**/*.{mts,sh}: Useful tasks for working with the projectgo.mod: Go module definition for the entire projectpitchfork.toml: Process manager config forpitchfork— runs all local services (mock-idp, server, worker, dashboard) in a single terminal with a tabbed UI. Usepitchfork list|status|logs|start|stop|restart <daemon>from the CLI.server/: Main backend service codebasecli/: Command-line interface for Gram that users use to interact with the Gram servicefunctions/: Serverless function runner powering the Gram Functions featurets-framework/functions/: TypeScript SDK for function authors (Gram.tool()API, manifest generation, MCP passthrough)client/: Frontend React application for Gram. Gram Elements — a chat interface that integrates with Gram MCP servers — lives inside it atclient/dashboard/src/elements/.
Contains the main application code for the Gram server:
internal/: The implementation of the server logic.background/: Temporal workflows and activities are implemented here.conv/: Useful conversion functions for converting between different Go types.mv/: Re-usable model views for representing Gram API resources.oops/: Error handling utilities to be used across Gram service implementation files.openapi/: OpenAPI parsing package used to generate tools as part of the Gram deployments service.testenv/: Utilities for setting up test environments that support writing tests.**/queries.sql: SQL queries used by various services. After editing these files run mise tasks to generate Go code.**/impl.go: The implementation of the service logic for each service.
cmd/: CLI commands for running the server and Temporal worker.database/: Database schemas and SQLc configuration.sqlc.yaml: SQLc configuration file.schema.sql: Database schema definition. Edit this file to change the database schema and use mise commands to generate a migration.
design/: Goa design files that define the public interface of the Gram service.gen/: Code generated types from Goa. Files in here cannot be modified directly.migrations/: Database migration files. Files in here cannot be modified directly.
mise go:tidy: Rungo mod tidyacross the codebasemise build:server: Build the server binarymise build:tunnel-gateway: Build the tunnel gateway binarymise lint:server: Run linters on the server codemise run start: Run the process manager that spins up local servers (server, worker, idp, ...)hk fix: Runs formatters across changed files in the current branch.
The main frontend application lives in client/dashboard/ (not client/ directly).
aube run -F dashboard type-check: Type-check the dashboardaube run -F dashboard build: Build the dashboardaube run -F dashboard dev: Run dev server
Use the gram-playwright-cli skill and mise run playwright for routine dashboard inspection, page interaction, console or network debugging, and screenshots. The mise task uses the repository Playwright config, installs Chromium when missing, and writes ignored artifacts to .playwright-cli/.
Use pr-demo-gif when a user-visible change needs a shareable PR screenshot, GIF recording, or PR comment. It builds on the same mise run playwright workflow and adds the capture and publishing steps. Do not use npm, npx, or yarn for either workflow.
.mcp.json registers the assistants-dev MCP server (server/cmd/dev-mcp), which drives the local management API without the dashboard UI. It logs into the local stack on its own (dev-idp auto-approves), so no setup is needed beyond a running dev stack. Use its tools — assistant CRUD, run_turn (send a message and wait for the assistant's reply), load_chat, and trigger CRUD — to exercise assistant runtime changes end to end. whoami lists the available project slugs.
Migration rules live in the postgresql skill (.agents/skills/postgresql/SKILL.md, "Database migrations" section). Activate that skill any time you touch server/migrations/, atlas.sum, or server/database/schema.sql.
The mise tasks listed in this guide should be used where building, testing or linting is needed. The commands can take arguments directly and don't need a -- separator. For example, to run the server in development mode, use:
mise run start
- Run
mise tasksto discover available tasks. - Run
mise run <task-name> --helpto get help for a specific task including any arguments it takes.
- Make the plan extremely concise. Sacrifice grammar for the sake of concision.
- Identify any available skills relevant to the task so you can activate them when implementing.
- At the end of each plan, give me a list of unresolved questions to answer, if any.
Use the pull-request skill when preparing pull requests. It contains the guidelines we follow to prepare work for review and how to present the PR title and description.
Full environment setup is handled by ./zero --agent (idempotent — re-run any time to reconcile): it installs tools/deps, generates keys/TLS + the dev-idp RSA key, starts the Docker infra, and runs the Postgres + ClickHouse migrations and finally starts all local services. Run it per session after starting the Docker daemon. It is deliberately NOT the startup update script — that stays minimal (mise install / mise run install), because starting infra and running migrations are too heavy and failure-prone for pod boot. Non-obvious caveats:
- Docker daemon must be running first. There is no systemd auto-start, so run
sudo service docker startbefore./zero --agent. Docker is configured with thefuse-overlayfsstorage driver andiptables-legacy. miseprovides all tooling (~/.local/bin/mise). Resolution is automatic insidemise run/mise execand mise tasks (including.mtsNode scripts) — no PATH hacks needed. For bare tool calls, shims are onPATHviamise activatein~/.bashrc(interactive) and via~/.bash_envreferenced byBASH_ENV(non-interactive script shells). Bash does NOT sourceBASH_ENVforbash -c, so in that context prefermise exec/mise run(orexport PATH="$HOME/.local/bin:$PATH").- Login is credential-less (
GRAM_IDP_MODE=mock-workos): click "Login", no username/password. - Pitchfork manages services: Either use the pitchfork mcp if running or fall back to the
pitchforkCLI. These both give you access to service health and logs.