Skip to content

πŸš€πŸ€– Autonomy-first (web-oriented) OpenCode starter for real autonomy β€” with MCP-first tooling, quality gates, and a pragmatic validation flow πŸ”’πŸ§ͺ

License

Notifications You must be signed in to change notification settings

larananas/opencode-autopilot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

5 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

opencode-autopilot

πŸš€πŸ€– Autonomy-first (web-oriented) OpenCode starter for real autonomy β€” with MCP-first tooling, quality gates, and a pragmatic validation flow πŸ”’πŸ§ͺ

If you’ve ever tried agentic coding and ended up with:

  • β€œDONE βœ…β€ without running anything,
  • random refactors you never asked for,
  • UI regressions that only show up after deploy,
  • or token-burning context dumps…

This repo is the missing scaffolding: a clean set of rules + memory + validation gates so OpenCode behaves like a solid teammate from day one.


Safety note (honest, not scary) πŸ”

This template is designed to be as safe as reasonably possible while keeping the agent highly autonomous β€” in a setup where OpenCode runs directly on your host (no container/VM sandbox by default).

What that means in practice:

  • βœ… You get tight workflow boundaries (rules + MCP-first policy + token budgets + validation gates).
  • βœ… You reduce the chance of accidental β€œbig mistakes” (by forcing real validation and avoiding huge data pulls).
  • βœ… You can keep secrets out of the repo (via env-based config).

But also:

  • ⚠️ OpenCode can still run with powerful capabilities. With broad permissions, mistakes can be destructive.
  • ⚠️ There is always a small residual risk (tool quirks, edge cases, unexpected prompts, human error).
  • βœ… The goal here is pragmatic safety (reduce risk a lot) while keeping the workflow fast and autonomous β€” not β€œperfect isolation”.

If you want near-zero blast radius: run in a container/VM. If you want maximum speed on your main machine: this repo helps you do it responsibly.


What you get ✨

Autonomy that stays honest

  • βœ… TODO-driven loop: pick a task β†’ implement β†’ validate β†’ retry β†’ escalate when blocked
  • πŸ§ͺ Quality gates: no β€œlooks good” DONE β€” the agent must prove it works
  • 🧰 MCP-first tool policy: filesystem / browser / DB / docker / API client before random bash/web hacks
  • βœ‚οΈ Token-budget rules: DB + API context stays small and relevant

Web-first (web-oriented) defaults, still adaptable

Default assumptions (easy to swap):

  • 🌐 UI exists and can be validated in a real browser
  • πŸ—„οΈ DB is MariaDB/MySQL
  • 🐳 Services may run in Docker
  • πŸ”Œ API smoke tests can be run via an HTTP client (Postmancer)

Non-web project? Different stack? Still usable β€” you’ll just adapt the MCP config + QUALITY gates.


Why MCP-first? 🧠🧰

MCP servers give the agent purpose-built tools with clearer boundaries than β€œdo everything with bash”:

  • filesystem MCP: safer, scoped file access (no wandering outside your project)
  • chrome-devtools MCP: validates UI behavior where it actually matters (real browser, real console)
  • mysql/mariadb MCP: schema-first + targeted reads (no table dumps)
  • docker MCP: inspect logs/status/exec without ad-hoc scripts
  • postmancer: quick, repeatable API smoke checks without reinventing curl flows

Net effect: fewer hallucinated validations, fewer accidental dumps, more reliable β€œDONE”.


Lara : OK, je te refais la section Project layout en incluant tes dossiers 01_generated, agent, command, memory, plugin, rules, skills, tools, et je marque clairement quand c’est optionnel / souvent vide avec un petit commentaire utile. πŸ‘Œ

Project layout 🧭

.
β”œβ”€ AGENTS.md                          # agent behavior + language & tone policy (source of truth)
β”œβ”€ TODO.md                            # task list (can be in any language)
└─ .opencode/
   β”œβ”€ 01_generated/                   # optional generated artifacts (templates, exports, snapshots) β€” safe to delete/rebuild
   β”‚                                   (often empty; useful for reproducible outputs without polluting the repo)
   β”œβ”€ agent/                          # optional agent profiles / modes / persona presets
   β”‚                                   (often empty; useful when you want multiple agent behaviors per repo)
   β”œβ”€ command/                        # optional command presets / shortcuts / repeatable workflows
   β”‚                                   (often empty; useful to standardize common actions like "run checks" / "smoke test")
   β”œβ”€ memory/                         # project memory the agent should rely on (keep updated)
   β”‚  β”œβ”€ STATE.md                     # project context: stack, ports, constraints, URLs
   β”‚  β”œβ”€ DISCOVERY.md                 # entrypoints + useful pointers (where to start, key modules)
   β”‚  β”œβ”€ QUALITY.md                   # validation commands + gates (incl. UI gate / Chrome MCP)
   β”‚  └─ CHANGELOG_DEV.md             # optional structured dev notes (often empty)
   β”œβ”€ plugin/                         # optional custom extensions / integrations for your workflow
   β”‚                                   (often empty; keep only if you maintain a plugin layer)
   β”œβ”€ rules/                          # hard rules the agent must follow (behavioral guardrails)
   β”‚  β”œβ”€ 00-core.md                   # tool policy, conventions, defaults
   β”‚  β”œβ”€ 10-safety-guard.md           # safety rails (no secrets, no destructive ops, etc.)
   β”‚  β”œβ”€ 20-git-guard.md              # git policy (often β€œno git unless asked”)
   β”‚  └─ ...                          # add more rules as your playbook grows
   β”œβ”€ skills/                         # optional playbooks for repeatable tasks (debugging, refactors, migrations)
   β”‚                                   (often empty; useful when you want consistent β€œhow to” procedures)
   └─ tools/                          # optional tool wrappers / helpers / small scripts used by the agent
                                       (often empty; useful if you standardize local tooling without bloating the main repo)

UI validation via Chrome DevTools MCP (required by design) 🌐πŸ§ͺ

This template expects UI-impacting changes to be validated using Chrome DevTools MCP β€” not just API calls. That’s how you avoid false β€œDONE” on:

  • routing/hydration issues
  • auth flows
  • layout regressions
  • error rendering
  • β€œworks in API but breaks in UI”

Install & docs:

If your project has no UI, replace the UI gate in .opencode/memory/QUALITY.md with an equivalent (CLI integration tests, snapshots, etc.).


Quickstart (5–10 minutes) ⚑

  1. Copy this starter into your project:

    • .opencode/
    • AGENTS.md
    • TODO.md
  2. Configure MCP servers (paths/ports/hosts):

    • filesystem MCP root β†’ your project directory
    • DB MCP β†’ your DB (MariaDB/MySQL by default)
    • Docker MCP β†’ your Docker daemon (if using containers)
    • Chrome DevTools MCP β†’ installed + able to connect to Chrome
    • Postmancer β†’ optional, but great for API smoke tests
  3. Update memory:

    • .opencode/memory/STATE.md β†’ architecture, ports, URLs, constraints or keep it "as-is".
    • .opencode/memory/QUALITY.md β†’ real lint/test/build commands + UI flows or keep it "as-is".
  4. Write a good TODO and run OpenCode.


MCP config: what to change for your project πŸ”§

This repo ships with a β€œknown good” MCP toolbox. You’ll typically adapt:

1) filesystem MCP

  • Change the root path to your project directory
  • Keep it scoped to avoid accidental reads/writes outside the repo

2) DB MCP (MariaDB/MySQL by default)

  • Update host/port/user/db name for your environment
  • Prefer env vars (e.g. {env:OPENCODE_DB_PASS}) instead of hardcoding secrets

If you’re not on MariaDB/MySQL:

  • Postgres β†’ swap the MySQL MCP server for a Postgres MCP server
  • SQLite β†’ use a SQLite MCP server (or keep DB ops minimal)
  • No DB β†’ disable DB MCP and remove DB gates from QUALITY

3) chrome-devtools MCP

  • Ensure Chrome is installed and reachable by the MCP server
  • Keep this enabled if your changes can affect UI behavior

4) docker MCP (optional)

  • Enable if your services run in containers (status/logs/exec)
  • Disable if you don’t use Docker (and remove Docker references in QUALITY)

5) postmancer (optional)

  • Useful for repeatable API smoke tests (especially when UI is not the best probe)

Writing β€œagent-proof” TODOs βœ…

A TODO should be executable without guesswork.

A good TODO contains:

  • expected behavior (observable)
  • scope (files/areas)
  • exact validation commands
  • UI flow to validate (if UI impact)
  • β€œDONE WHEN” criteria

Example:

- [ ] T42: Fix redirect after token refresh
  Expected: after refresh, user stays on original route
  Scope: frontend auth composable + backend refresh endpoint
  Validate:
    - npm run lint
    - npm test
    - npm run build
    - UI: open /account, refresh page, verify still on /account (Chrome MCP)
  DONE WHEN: all validations PASS and no console errors

MCP-first tool policy (high level) 🧰

  • filesystem MCP: default for file ops
  • chrome-devtools MCP: default for UI checks + console
  • DB MCP: schema-first + small samples (LIMIT 4), never dump tables
  • postmancer: default for API smoke tests
  • docker MCP: default for status/logs/exec
  • webfetch/websearch: external docs only (not for testing your app)

Token budget rules (DB/API) βœ‚οΈ

  • Never dump tables or giant JSON blobs.

  • Prefer schema introspection first (tables, columns, constraints).

  • For data shape, sample 3–4 rows max (LIMIT 4).

  • For big API responses, keep only:

    • first ~450 chars or
    • first 3 objects whichever best represents structure.

Language policy 🌍

  • All files (code, comments, docs) are written in English.
  • User interaction (chat) follows the user’s language.
  • TODO.md can be written in any language.

Recommended operating discipline 🧠

  • Review diffs. Commit early. Commit often.
  • Keep backups/snapshots.
  • Start restrictive on permissions, loosen gradually.
  • Don’t store secrets in the repo.

License

MIT

About

πŸš€πŸ€– Autonomy-first (web-oriented) OpenCode starter for real autonomy β€” with MCP-first tooling, quality gates, and a pragmatic validation flow πŸ”’πŸ§ͺ

Topics

Resources

License

Stars

Watchers

Forks