opencolab
AGENTS.md11 starsChanged 8 months agoMITView on GitHub
Top-level sources of truth: Core implementation areas:
- Reads credentials
Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about checking a change actually works.
Of the AGENTS.md files we read, the 11,773 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
In this repositoryOne other file it gives its agents.
- CLAUDE.mdCLAUDE.md
The file
Show its rules and text
We split this AGENTS.md into the rules it gives an agent
17 rules. About 1 is common, 11 are distinctive, and 5 are very specific to this project.
≈1
Common · estimate
Many files like this have a rule of this kind.
≈11
Distinctive · estimate
This author's own choices. Worth a look.
5
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- could be automatic: a setting could enforce it
- Distinctive: line 5
Keep repository guidance aligned with the actual runtime, not aspirational structure.
- Very specific: line 58
Location resolution: If OPENCOLAB_ACTIVE_AGENT is set, write under projects/<project>/AGENTS/<agent>/research/.
- Distinctive: line 92
Use these commands for normal development:
- Distinctive: line 120
Keep code ASCII unless non-ASCII is required.
- Distinctive: line 121
Prefer small, focused modules and explicit types on public interfaces.
- Distinctive: line 123
Keep state normalization and path-building logic deterministic and easy to test.
- Very specific: line 124
Prefer updating provider/runtime defaults in one place (src/provider.ts) and secret/env behavior in one place (src/secrets.ts).
- Distinctive: line 125
Keep CLI copy, onboarding prompts, and Telegram responses concise and concrete.
- Distinctive: line 126
Keep comments concise and only where logic is non-obvious.
- Very specific: line 129
Place tests in tests/.
- Distinctive: line 130
Use deterministic tests with the built-in Node test runner.
- Distinctive: line 131
Keep coverage focused on:
- Very specific: line 143
Run pnpm run check && pnpm run build && pnpm test before pushing.
- Distinctive: line 158
follow-up work or limitations.
- Common: line 161
Never commit secrets (API keys, tokens, private keys).
- Very specific: line 162
Use environment variables (OPENAI_API_KEY, ANTHROPIC_API_KEY, GEMINI_API_KEY, MINIMAX_API_KEY, XAI_API_KEY, RUNPOD_API_KEY, …
- Distinctive: line 164
Keep local runtime artifacts out of git:
≈ “Common” is an estimate: at least 1 in 5 of the 16,595 AGENTS.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
Repository Guidelines
Project Structure & Module Organization
OpenColab is a TypeScript/Node.js ESM CLI and local gateway for a multi-project, multi-agent research workflow. Keep repository guidance aligned with the actual runtime, not aspirational structure.
Top-level sources of truth:
docs/spec.md: source of truth for requirements and architecture.docs/VISION.md: product direction and long-term intent.README.md: quickstart, high-level overview, and condensed runtime/reference guide.package.json: npm package metadata, published CLI surface, and pack/publish lifecycle hooks.pnpm-workspace.yaml: root pnpm workspace definition; includessrc/web/client/so one root install provisions the Vite web UI dependencies used bypnpm run build.install.sh: package-first macOS/Linux installer, managed-install manifest writer, and command shim setup, with optional--hackygit-clone fallback.install.ps1: package-first Windows PowerShell installer, managed-install manifest writer, and command shim setup, with optional--hackygit-clone fallback.projects/SKILLS/: shared built-in skill library copied into agent prompts, not per-project duplicates, including search, summarization, grounded paper QA, scientific LaTeX paper/report writing, image, architecture-diagram, and iterative experiment-loop workflows. Packaged installs must ship this directory too.src/: TypeScript implementation.src/web/: OpenColab Studio implementation, with read-only gateway API handlers inserver/, shared DTOs inshared/, and the Vite/React/Tailwind/shadcn client workspace inclient/.src/agent-templates/: built-in agent markdown scaffolds loaded by the runtime when seeding agent files and prompt context, with shared files inshared/and role-specific folders such asprofessor/,beginner/,autoresearch/, andspecialist/. RoleAGENTS.mdtemplates should stay concise and avoid restating detailed rules already owned by shared files or injected built-in guidance. Packaged installs must ship the runtime-accessible equivalents.tests/: Nodenode:testsuite.
Core implementation areas:
src/cli.ts: CLI entrypoint, top-level help/version output, interactive prompts, setup flows including standalone provider-key writes, and gateway lifecycle commands.src/ignite.ts: first-run onboarding for project selection, curated provider model/auth/reasoning setup including OAuth-capable provider flows, direct API-key setup links, BotFather token guidance, built-in shared-tool key setup includingGEMINI_API_KEYprerequisites for Gemini shared tools andpageindex-grounded, Telegram setup, and pairing.src/runtime.ts: stateful orchestration across config, project state, gateway routing, memory, and provider execution.src/workflows/: project-scoped workflow XML parser/validator, sequential runner, in-process live registry, andWorkflowServicefacade consumed by the CLI, runtime, and web layers.src/experiments.ts: local experiment bookkeeping helpers for target snapshots, run manifests, status files, logs, artifacts, and sync metadata.src/gpu-providers/runpod/index.ts: Runpod-backed execution-target validation, availability-aware location/GPU selection, Pod lifecycle, SSH sync/bootstrap/launch, and run reconciliation.src/manual-ssh.tsandsrc/manual-ssh-worker.ts: saved manual Pod SSH profile management, transcript-backed live session control, and detached SSH session worker lifecycle.src/http.ts: local HTTP server, health/state endpoints, per-bot Telegram webhook ingestion (/api/telegram/webhook/<bot_id>), and optional multi-bot long polling startup with a supervisor that re-reads the bot registry.src/gateway.ts: per-bot Telegram authorization and pairing, bot-scoped target resolution, command routing including/stopcancellation with recovery summaries, typing updates, live-status ownership, split final-text delivery, and Telegram API error reporting. Every outbound call carries an explicitTelegramBotContext; nothing in this module resolves a token from ambient process state.src/gateway-service.ts: persistent background gateway service management for macOSlaunchd, Linuxsystemd, and hidden always-restarting Windows Task Scheduler user tasks.src/telegram-poller.ts: one independent long-polling loop per enabled bot, a supervisor that starts/stops loops as the registry changes,getMeidentity lookup used to validate tokens before binding, and the pairing handshake. ThebotIdalways comes from the loop that owns the token, never from the update payload.src/upgrade.ts: install-aware OpenColab upgrade flow for one-link installer-managed package or clone installs plus manual git/source checkouts, with guidance only for generic package installs.src/provider.ts: provider defaults including concrete model defaults, runtime selection, auth-mode support, OAuth setup/remediation hints, CLI args including current Claude Codestream-jsonrequirements, migration signatures for previously-shipped Claude and pi defaults, and env wiring. Repo-managed CLI args must never carry prompt text in argv: the prompt outgrows the OS command-line limit as agent memory and transcript accumulate, so it travels over stdin, or by file path for thepiruntime's--append-system-prompt. Superseded arg sets belong inmigratableCliDefaultsso stored configs are upgraded on load.src/provider-agent.ts: provider-backed execution, runtime preflight/error handling including OAuth session checks for supported runtimes, staging of the pi system prompt into a temporary file it also cleans up, and provider-to-gateway progress-event forwarding.src/agent.ts: agent file seeding, shared/agent-local skill discovery, and prompt assembly.src/agent-templates.ts: built-in agent template loading and default-doc resolution.src/conversation.ts: per-agent session logs, previous-day summaries, and prompt-memory loading.src/install.ts: install-root detection, installer-managed install manifest handling, and runtime-root resolution acrossOPENCOLAB_ROOT, packaged-install defaults, and cwd fallback for source checkouts.src/project-config.ts:opencolab.jsondefaults, normalization, migration including recognized stale Claude CLI arg upgrades and the v2 -> v3 Telegram bot registry migration, stale-runtime-safe state merging, atomic writes, and project/agent and bot-registry helpers.src/config.ts: root config, runtime-root-aware path resolution, and local env loading.src/secrets.ts:.env.localsecret read/write/remove helpers, including per-bot Telegram token resolution with no cross-bot fallback.src/web/server/: OpenColab Studio HTTP handlers and static asset resolution for source and packaged installs.src/types.ts: shared persisted-state and runtime interfaces.
Agent contract details that matter for implementation:
- Each project must seed
projects/<project_id>/PROJECT-AND-TEAM.mdas the canonical shared project context file visible to all agents, with YAML front matter for shortproject_name, shortproject_description, and singleproject_emoji. - Agent directories live under
projects/<project_id>/AGENTS/<agent_id>/. - Required agent files are
AGENTS.md,BOOTSTRAP.md,IDENTITY.md,ALMA.md,TOOLS.md,USER.md,TODO.md,MEMORY.md,HEARTBEAT.md, plus agent-localSKILLS/. HEARTBEAT.mdmust be seeded as an empty file when an agent is created, stays disabled by default, and only enables delayed auto-wake behavior when the user adds a validafter:value; it may also include optionalnotify: digestfor one compact paired-chat Telegram follow-up after a meaningful heartbeat run finishes, optionalnotify: liveto reuse Telegram live status while the heartbeat turn runs, and optionalmessage: <plain text>to replace the defaultcontinueheartbeat prompt.- Shared skills live only under
projects/SKILLS/; do not duplicate them into each project or agent. Source and packaged installs must both provide the built-in shared skill library. - The shared
block-diagramskill defaults to compact layouts with unlabeled arrows, supports optional LaTeX equation blocks when they materially clarify a model or pipeline, may consult its optional ML/LLM architecture template for neural-network, transformer, training, or quantization diagrams, and only uses edge labels when they carry concrete meaning such as a protocol or payload, not genericinputoroutputtext. - The shared
fast-research,pro-research, anddeep-researchskills must keep theirfindings.mdformats stable while storing each distinct research topic in its own dated, topic-sluggedresearch/<YYYY-MM-DD>-<topic-slug>/folder, maintaining rootresearch/INDEX.mdand per-runRUN.mdmetadata, producing a companion literature-map block diagram throughblock-diagram, returning concise, friendly channel-agnostic summaries, and, when appropriate, returningfindings.mdplus a PNG-first diagram through the active channel's file-delivery mechanism, with SVG fallback if PNG rendering is unavailable. - Research output contract (consumed by OpenColab Studio's research browser, see
docs/research_browser_spec.md):- Location resolution. If
OPENCOLAB_ACTIVE_AGENTis set, write underprojects/<project>/AGENTS/<agent>/research/. Otherwise write underprojects/<project>/research/. All artifacts must stay inside the chosen run folder — never write to~/Downloadsor paths outside the run. - Folder naming.
<YYYY-MM-DD>-<topic-slug>where the slug is lowercased, ASCII-only, hyphen-separated, and ≤ 60 chars. Collisions append-2,-3, …. RUN.mdfrontmatter. Each run folder must contain aRUN.mdwhose first block is YAML frontmatter delimited by---lines. Required keys:skill,topic,status(one ofrunning,complete,failed,abandoned),created(ISO 8601). Optional keys:question,updated,corpus.papers,corpus.summaries,corpus.diagrams,deliverables(a flat YAML list of relative paths). Free-form notes belong below the frontmatter.INDEX.mdcolumns. A markdown table with one row per run, columns in fixed order:Folder | Skill | Topic | Status | Created | Updated | Corpus | Deliverables | Notes.- Artifact placement. PDFs in
pdf/<safe_id>.pdf; colocatedpdf/<safe_id>.mdper-paper summaries; diagrams indiagrams/*.{png,svg,d2}(PNG preferred); metadata inmeta/; search results insearch/; PageIndex output inpageindex/(trees/,manifest.json,answers/).
- Location resolution. If
- The shared
pageindex-groundedskill is the canonical local-first path for grounded follow-up QA over already-downloaded papers. It must keep selection bounded, prefer the active topic-scoped research folder selected fromresearch/INDEX.md, cache PageIndex trees under that run folder'spageindex/, useGEMINI_API_KEYfor the local PageIndex runner, and answer with exact paper or page references plus explicit limitations when coverage is partial. - The shared
pdf-figure-extractskill is the canonical local-first path for extracting and returning figures from already-downloaded papers. It must use PyMuPDF, prefer the active topic-scoped research folder selected fromresearch/INDEX.md, work even when PageIndex artifacts are missing, optionally reuse that run folder'spageindex/artifacts to narrow candidate pages, and require multimodal verification of shortlisted figure candidates when the active provider supports local image inspection. - The shared
latex-paper-writerskill is the canonical path for creating, editing, versioning, compiling, and returning scientific LaTeX papers, reports, and research-derived PDF summaries. It must keep each paper workspace under Git version control, use venue-aware templates without claiming official compliance unless verified, compile withlatexmkwhen available while surfacing install guidance when missing, generate experiment-result tables, reusedeep-research/pro-research/fast-researchfindings andpageindex-groundedevidence, usepdf-figure-extractandblock-diagramfor visuals when appropriate, and return final PDFs through the active channel's file-delivery mechanism when requested. - The shared
autoresearchskill is the canonical path for iterative keep/discard experiment loops over one explicitly configured repo. It is a normal shared skill available to every agent, but the built-inautoresearchagent is the default owner for sustained experiment-loop work. It must require explicitrepo_path,editable_file_path,run_command, andmetric_rule, treat non-zero exit or missing metric as failure by default, use a dedicated disposable branch or worktree for keep/discard iteration, must not assumetrain.pyoruv run train.py, and must include a progress-graph helper for key-metric-over-experiment plots with green kept experiments, gray discarded or non-kept experiments, short kept-experiment labels, and a running-best line. - The shared
runpod-jobskill is the canonical AI-facing path for Runpod work. Even though the OpenColab Runpod CLI remains supported, the default skill workflow should assume live GPU capacity may be the blocker: ask the human to manually create a Runpod Pod with the desired GPU, wait for the user to provide thepod_id, save or reuse a project-scoped manual SSH profile throughopencolab gpu ssh profile ..., and then useopencolab gpu ssh session start|read|write|stopas the default control path for that user-managed Pod instead of parking in raw direct SSH. The skill must describe that manual path as outside the normal OpenColabrun_idlifecycle, must not invent arun_id, and must not claim thatopencolab gpu job execworks directly against a rawpod_id. It should preferopencolab gpu ssh profile testbefore starting a session, set an active-agent default when appropriate, and only use boundedscp,rsync, or one-shotsshhelpers when file transfer or an explicit user request requires them. If the user explicitly wants the OpenColab-managed lifecycle, the skill may instead useopencolab gpu serverandopencolab gpu job, should useopencolab gpu server availability --server-id <id>when current datacenter or GPU stock needs to be checked before launch, should pay attention to warnings about Pod-API-incompatible datacenters or known storage-provisioning failures, and should useopencolab gpu job exec --run-id <id> --command "<remote command>"for bounded direct Pod inspection when SSH-backed access is needed. On that managed path it must launch jobs in detached mode with--wait false, return therun_idpromptly, refresh the run withopencolab gpu job status --run-id <run_id>before reporting so the latest remote logs are downloaded locally, reviewbootstrap,stdout,stderr, andpollerwhen summarizing a run, prefer a singleNVIDIA A100 80GB PCIeGPU withkeep_warmfor curated targets, ask the user whether to keep a finished warm Pod running or cancel it, usepytorch-cu12for curated/default targets, and surface failed or degraded runs clearly with a proposed next action. - Conversation history belongs under agent-local
memory/Session/andmemory/Daily/, not under.opencolab. - Routed provider timeouts or failures must preserve the inbound user turn and append a compact assistant recovery entry to the active session history, while keeping raw progress events out of normal conversation memory.
TOOLS.mdis the user-owned local tooling layer; repo-managed built-in tool guidance must be injected at prompt-build time rather than copied intoTOOLS.md.- The seeded
ALMA.mdcontract must encode a completeness-first execution standard: search before building, test before shipping, prefer permanent fixes over nearby workarounds, and finish the whole task when the real solution is within reach. - The seeded
AGENTS.mdcontract must require agents to readBOOTSTRAP.mdbeforeALMA.mdwhenever bootstrap still exists, so first-contact identity setup cannot be skipped. - The seeded
TODO.mdcontract must keep a lean working list with only the current focus, top priorities, and live blockers, defaulting to at most three open priority items unless the user explicitly asks for a broader plan. - The seeded
AGENTS.mdcontract must require agents to continuously maintainTODO.md, rewriting it when priorities change and deleting completed or stale items instead of accumulating backlog or done-history there. - The seeded
AGENTS.mdcontract must explain thatPROJECT-AND-TEAM.mdis the project-scoped shared context file, is read afterTODO.mdand beforeMEMORY.md, and must be consulted before agents edit it. - The seeded
professorcontract must require fillingPROJECT-AND-TEAM.mdfront matter with a short project name, short project description, and single project emoji when the project identity is known. - The seeded
professorcontract must teach professor-led specialist creation through the OpenColab CLI, require human approval before creation, and require roster updates inPROJECT-AND-TEAM.md. - The seeded
autoresearchcontract must orient that agent around iterative experiment execution through the sharedautoresearchskill, default ownership of sustained experiment-loop work, and explicit carry-forward of repo-contract details, user corrections, rejected paths, and lessons from failed runs. - The seeded
specialistandbeginnercontracts must state that they do not create more specialists by default and should route staffing recommendations back throughprofessor. - Telegram bots live in an installation-scoped
telegramBotsregistry inopencolab.json, one enabled bot per project. The inbound bot decides the project and target agent; globalactiveProjectIdparticipates in Telegram routing only for a legacyfloatingbot. Bot tokens live only in.env.localunder each bot's owntokenEnvVar, are validated withgetMebefore a binding is persisted, and never fall back between bots. A project with no bound bot receives no heartbeat or workflow notifications rather than having them delivered into another project's chat. /agentsin a project-bound chat sets that bot's own target agent and must not writeproject.activeAgentIdoractiveProjectId;/projectsin such a chat is informational only. Provider turns for one agent serialize across bots, chats, web chat, and heartbeat because they share the same session files.- The seeded
AGENTS.mdcontract must explain that OpenColab owns Telegram live status for routed runs, derives it from runtime events instead of an agent-written progress file, expects agents to avoid low-signal step-by-step chatter, and may surface a bounded recent tool-activity list in a persistent Telegram live-status message that remains visible after the final answer. - Telegram live status should mark the newest visible line with
🟢and older visible lines with⚪so the current step remains obvious in chat. - Codex lifecycle events such as
item.started,item.completed, andturn.completedmust be normalized before Telegram rendering and must never appear verbatim in live status text. - Routed Telegram text replies should be prefixed with the answering agent id on the first line, but that transport-only label must not be copied into normal conversation memory.
- The seeded agent docs must explain that Telegram file return directives must be emitted as raw
@telegram-file <json>lines rather than markdown-wrapped snippets, and may reference relative paths, absolute paths including Windows drive-letter or UNC paths, orfile://URLs. - The shared
workflow-builderskill is the canonical path for authoring and operating project workflows. Workflows live underprojects/<project_id>/workflows/<workflow_id>/workflow.xml, runs persist toprojects/<project_id>/workflows/<workflow_id>/runs/<run_id>/(RUN.md,state.json,status.json,events.jsonl,inputs/,steps/), and execution is driven through the CLI (opencolab workflow ...) or the runtime API; the skill must not pretend to be the workflow engine.
For behavior changes, update docs/spec.md first, then sync README.md, AGENTS.md, and code in the same change.
Build, Test, and Development Commands
Use these commands for normal development:
pnpm installpnpm run check(TypeScript typecheck)pnpm run buildpnpm testnode dist/src/cli.js upgradenode dist/src/cli.js ignitenode dist/src/cli.js gateway start --foreground true --port 4646node dist/src/cli.js gateway statusnode dist/src/cli.js project shownode dist/src/cli.js gpu server listnode dist/src/cli.js gpu server availability --server-id <id>node dist/src/cli.js gpu ssh profile listnode dist/src/cli.js gpu ssh session listnode dist/src/cli.js gpu job listnode dist/src/cli.js gpu job exec --run-id <id> --command "<remote command>"
Useful repository checks:
rg --files docs src tests projects/SKILLSrg -n "pattern" docs/spec.md docs/VISION.md README.md src testsgit diff -- docs/spec.md docs/VISION.md README.md AGENTS.mdgit status --shortnpm pack --dry-run
Coding Style & Naming Conventions
- Language: TypeScript (Node.js ESM).
- Keep code ASCII unless non-ASCII is required.
- Prefer small, focused modules and explicit types on public interfaces.
- Naming:
kebab-casefilenames,camelCasefunctions/variables,PascalCaseclasses. - Keep state normalization and path-building logic deterministic and easy to test.
- Prefer updating provider/runtime defaults in one place (
src/provider.ts) and secret/env behavior in one place (src/secrets.ts). - Keep CLI copy, onboarding prompts, and Telegram responses concise and concrete.
- Keep comments concise and only where logic is non-obvious.
Testing Guidelines
- Place tests in
tests/. - Use deterministic tests with the built-in Node test runner.
- Keep coverage focused on:
opencolab.jsondefaults/migrations- project and agent file seeding plus prompt assembly (
PROJECT-AND-TEAM.md,AGENTS.md,BOOTSTRAP.md,IDENTITY.md,ALMA.md,TOOLS.md,USER.md,TODO.md,MEMORY.md,HEARTBEAT.md,SKILLS/) - shared skills vs agent-local skills behavior
- npm/package publish surface, packaged asset availability, and install-mode-aware upgrade behavior
- provider defaults, auth modes, CLI args, runtime env wiring, and preflight/remediation behavior
- availability-aware Runpod target normalization, fallback selection inputs, and per-location volume behavior
igniteonboarding branches, including keep-existing setup and Esc-to-skip flows- Telegram authorization, pairing flow, slash-command aliases, routing, and file/media handling
- long-running task progress updates from provider runtime to Telegram without polluting conversation memory
- conversation memory persistence in
memory/Session/andmemory/Daily/ - background gateway service rendering/status logic where it is pure and testable
- Run
pnpm run check && pnpm run build && pnpm testbefore pushing.
Commit & Pull Request Guidelines
Use Conventional Commits:
feat: add pi-backed provider onboardingfix: preserve active agent during state normalizationdocs: sync spec readme and agents guidancetest: cover telegram file routing fallback
PRs should include:
- concise summary of what changed and why,
- affected files/modules,
- verification steps run,
- follow-up work or limitations.
Security & Configuration Tips
- Never commit secrets (API keys, tokens, private keys).
- Use environment variables (
OPENAI_API_KEY,ANTHROPIC_API_KEY,GEMINI_API_KEY,MINIMAX_API_KEY,XAI_API_KEY,RUNPOD_API_KEY,TELEGRAM_BOT_TOKEN). - Provider CLI execution defaults to 30 minutes and can be overridden locally with
OPENCOLAB_PROVIDER_CLI_TIMEOUT_MS. - Keep local runtime artifacts out of git:
opencolab.json.env.local.opencolab/projects/*/experiments/runs/projects/*/AGENTS/*/memory/projects/*/memory/TelegramInbox/
- Redact personal or host-identifying information when sharing logs/docs externally.
- Provider CLIs run with workspace access; keep added directories and permission changes narrowly scoped.
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.

