mainframe
CLAUDE.md44 starsChanged 4 months agoMITView on GitHub
AI-native development environment for orchestrating agents. Issues live in the Mainframe app's todos plugin (per-project SQLite, ~/.mainframe/plugins/todos/data.db). See docs/guides/issue-tracker.md. Five canonical triage roles (needs-triage, needs-info, ready-for-agent, ready-for-human, wontfix), stored in each todo's labels JSON column. See docs/guides/triage-labels.md. See docs/ARCHITECTURE.md for the full design.
- Installs packages
In this repository10 other files it gives its agents.
- AGENTS.mdAGENTS.md
- assistant-uiSkill
- changelog-watchSkill
- claude-protocol-debuggerSkill
- codex-protocol-debuggerSkill
- mainframe-design-systemSkill
- radix-ui-design-systemSkill
- release-downloadsSkill
- shadcnSkill
- tauri-v2Skill
The file
We split this CLAUDE.md into the rules it gives an agent
6 rules. About 0 are common, 5 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈5
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 17
Before any new bug/feature work, pull latest main and start a new branch on it
- Distinctive: line 18
Before any work, check needed skills to guide your development see Skills
- Distinctive: line 21
Prefer running single tests, and not the whole test suite, for performance
- Distinctive: line 81
PR descriptions: Use .github/pull_request_template.md for manual and automated PRs.
- Distinctive: line 82
Never commit to
main: Always work on a feature or fix branch. - Very specific: line 83
Check branch before destructive git ops: Before reset, rebase, or push --force, verify the current branch with git status or git branch.
≈ “Common” is an estimate: at least 1 in 5 of the 12,729 CLAUDE.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Mainframe
AI-native development environment for orchestrating agents.
Agent skills
Issue tracker
Issues live in the Mainframe app's todos plugin (per-project SQLite, ~/.mainframe/plugins/todos/data.db). See docs/guides/issue-tracker.md.
Triage labels
Five canonical triage roles (needs-triage, needs-info, ready-for-agent, ready-for-human, wontfix), stored in each todo's labels JSON column. See docs/guides/triage-labels.md.
Workflow
- Before any new bug/feature work, pull latest main and start a new branch on it
- Before any work, check needed skills to guide your development see Skills
- For Claude CLI behavior, use the
claude-source-researcherskill (reads the CLI source directly). Protocol docs are indocs/research/adapters/claude/, verified against the 2026-03-31 source leak and CLI v2.1.220: SESSIONS_JSONL (transcript format, directory layout, worktree relocation), HOOKS, PERMISSIONS, SLASH_COMMANDS, CLEAR. Two older docs are kept with staleness banners — read the five above first: PROTOCOL_REVERSED (v2.1.37; still the only coverage of the--sdk-urlWebSocket transport) and CLAUDE-JSONL-SCHEMA (v2.0.76–2.1.34 field frequencies, subordinate to SESSIONS_JSONL). For which fields Mainframe actually consumes, see the consumed-surface checklists (Claude, Codex); verify a suspected live change against.claude/skills/claude-protocol-debugger/or.claude/skills/codex-protocol-debugger/. - Be sure to typecheck when you're done making a series of code changes
- Prefer running single tests, and not the whole test suite, for performance
- For git workflow and commit practices, see Git
Tech Stack
- Language: TypeScript (strict mode, NodeNext modules) + Rust (Tauri shell,
packages/app-tauri/src-tauri) - Runtime: Rust
mainframe-daemon(packages/core-rs); Tauri 2 desktop shell - Package Manager: pnpm workspaces (+ Cargo for the Rust daemon and shell)
- Database: SQLite (
rusqlite) - UI: React + Tailwind v4 in
packages/ui, consumed by the Tauri shell
Commands
pnpm install— Install dependenciespnpm build— Build all packagespnpm --filter @qlan-ro/mainframe-types build— Rebuild shared types after changing thempnpm --filter @qlan-ro/mainframe-ui test— Test a specific packagepnpm --filter @qlan-ro/mainframe-ui exec vitest run <file>— Single test file (preferred; large multi-suite runs hit cross-fileReact.actfailures)pnpm --filter @qlan-ro/mainframe-ui typecheck— Typecheck the UI. Types has notypecheckscript; usepnpm --filter @qlan-ro/mainframe-types exec tsc --noEmitpnpm tauri:dev(frompackages/app-tauri) — Tauri dev app; run in background with output to a log filecargo check(frompackages/app-tauri/src-tauri) — Fast Rust validationpnpm test:e2e— Playwright E2E suitepnpm changeset— Required before committing (see Git)
Architecture
See docs/ARCHITECTURE.md for the full design.
- Monorepo Structure: pnpm workspaces with five packages (plus the mobile submodule):
@qlan-ro/mainframe-types: Shared TypeScript interfaces and domain models.@qlan-ro/mainframe-ui: The shared React renderer, consumed by the Tauri shell. Itspackage.jsonversion is what the release pipeline tags from (the old TS daemon package that used to carry it is deleted).@qlan-ro/mainframe-app-tauri: Tauri 2 desktop shell (Rust insrc-tauri/). Ships the Rust daemon (packages/core-rs) as a bundled sidecar.@qlan-ro/mainframe-e2e: Playwright end-to-end suite.@qlan-ro/mainframe-mobile: Git submodule (separate repo — cross-cutting changes need their own PR there; don't bump the pointer in feature PRs).
- Metadata Storage: SQLite (
better-sqlite3) for project tracking and chat metadata. Message history is NOT duplicated; CLI agents replay it via--resume.
Terminology
AgentAdapter = a CLI tool integration (Claude, Gemini, Codex, OpenCode) the daemon spawns as a child process — interface in packages/types/src/adapter.ts. Agent/Subagent = a task worker spawned within a session by the AI (the left-panel "Agents" tab), not a CLI adapter.
Skills
Invoke the listed skill before taking the described action. No exceptions.
| Trigger | Skill |
| Any bug, error, or unexpected behavior — even when the cause looks obvious | systematic-debugging |
| Building a new feature, adding functionality, or changing behavior | brainstorming |
| Multi-step implementation task, or after brainstorming approval | writing-plans |
| Writing implementation code for any feature or bugfix | test-driven-development |
| About to claim work is done, commit, or open a PR | verification-before-completion |
Writing any markup or class names in packages/ui | mainframe-design-system |
| Open visual-design questions with no in-app template to mirror | ui-ux-pro-max |
| Writing docs, commits, PRs, error messages, or UI copy | writing-clearly-and-concisely |
| Checking whether new Claude Code / Codex releases affect Mainframe's adapters | changelog-watch |
Domain skills (typescript-expert, nodejs-best-practices, vercel-react-best-practices, senior-architect, code-audit) are preloaded by the roster agents in ~/.claude/agents/ — delegate to core-dev/ui-dev/planner/test-writer/quality-reviewer instead of invoking them inline.
Git
- PR descriptions: Use .github/pull_request_template.md for manual and automated PRs. CLI-created PRs must fill it explicitly; keep its headings, order, and checklist. Put additional pipeline context in comments.
- Never commit to
main. Always work on a feature or fix branch. Rungit branch --show-currentbefore any commit or reset to confirm you are not onmain. - Check branch before destructive git ops. Before
reset,rebase, orpush --force, verify the current branch withgit statusorgit branch. - Never discard unstaged changes you didn't create. They may be in-progress work from another session. When committing, stage only your own files by name. Do not
git checkout --,git restore, orgit stashother people's changes. - Changesets required. Every PR must include a changeset file. Run
pnpm changesetbefore committing, pick the affected packages and bump type (patch/minor/major). For PRs that don't need a changelog entry (CI, docs typos), runpnpm changeset --empty. The pre-push hook and CI will reject without one.
Code Rules
Each rule exists because a violation required cleanup.
- No shell interpolation —
execFile/execGitwith array args; neverexecSyncwith template strings. - Validate input —
resolveAndValidatePath()for user-supplied paths; identifiers match^[a-zA-Z0-9_-]+$; Zod on every endpoint and WS message. - Max 300 lines/file, 50/function — decompose before merging.
- No silent catches; no console. in core* — every catch logs via pino (
createChildLogger); desktop fire-and-forget uses taggedconsole.warn; intentional silence needs an/* expected */comment. - No sync I/O in the daemon —
node:fs/promises+ asyncexecGit; sync calls block the event loop. - Single canonical type — define once in
@qlan-ro/mainframe-types; desktop depends on core viaworkspace:*; pure logic (parsing, status derivation, transforms) lives in core, not React. - Tests required — new routes/DB methods/core logic get test files; don't lower coverage thresholds; parse JSON columns via
safeJsonArray, never bareJSON.parse. data-testidon every interactive element —<surface>-<element>kebab-case, keyed by domain id not array index;ui/primitives stay passthrough.- Lazy-load heavy components — editors/visualizations via
React.lazy+Suspense. - Hygiene — no
@ts-ignore(use@ts-expect-error+ reason); comments say why, not what; remove dead code; extract shared helpers at 3+ duplications. - No leftovers — never close a feature with small deferred cleanups (dead code, stale comments); fix them in the same pass. "Deferred" is only for genuinely separate work.
Disk Hygiene
Cargo never garbage-collects target/. Left alone, the two Rust target dirs reached 54 GB — every dependency, feature, or toolchain change strands the previous generation of artifacts permanently.
- Keep the dev debuginfo caps. Both Rust manifests pin
[profile.dev] debug = "line-tables-only"and[profile.dev.package."*"] debug = false. Backtraces still carry file:line; dependencies carry nothing. The defaultdebug = 2costs 4–6× the disk per build generation. - Sweep; don't wait for the disk to fill.
cargo install cargo-sweep, thencargo sweep --installed && cargo sweep --time 14in each target dir, drops stale fingerprints and leaves the current build warm.cargo clean --profile devreclaims tens of GB at once and sparesrelease/, so packaging doesn't rebuild cold. - Do not set
CARGO_TARGET_DIR. Five consumers hardcodepackages/core-rs/target/{release,debug}: daemon discovery inapp-tauri/src-tauri/src/lib.rs,e2e/fixtures/daemon.ts,provision-rust-daemon.mjs,build-standalone.sh, andbuild-release-local.sh. Redirecting the target dir breakstauri:dev, the E2E suite, and packaging. Teaching those five to honor the variable is the prerequisite for sharing a target dir at all — including across worktrees, so until then every.worktrees/*checkout that runscargogrows its own multi-GBtarget/. packages/core-rsandpackages/app-tauri/src-tauriare separate workspaces. They share 142 dependencies by version but only 109 by resolved feature set, and those 109 are ~29% of shared source volume — the expensive crates (tracing,tokio,libc,rustix) differ. Do not merge the workspaces to dedupe them: profiles apply only at a workspace root, so src-tauri'sltoandpanic = "abort"would reach the daemon, and feature unification would hand ittokio/test-utilandlibc/extra_traitsin production builds.- Measure before blaming the worktrees.
du -sh packages/*/targetaccounts for most of the repo's size; a worktree stays ~23 MB until someone builds in it.
Environment Variables
| Variable | Description | Default |
DAEMON_PORT | Daemon HTTP + WebSocket port | 31415 |
VITE_PORT | Vite dev server port | 5173 |
MAINFRAME_DATA_DIR | Data directory | ~/.mainframe |
LOG_LEVEL | Logging verbosity | info |
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

