// System architecture
ARCHITECTURE
One gate you paste into Perplexity, three engine files you upload. Here's exactly how GAIA Code wires itself together — and how a single turn runs.
// Deployment flow
ONE GATE. THREE ENGINES.
Paste the gate into your Space Instructions; upload the three engine files. GAIA reads all three on startup — skip one and that engine goes dark.
SYSTEM_INSTRUCTIONS.mdThe gate
Pasted into the Space Instructions field. Switches GAIA on, points it at the other three files, and hosts the slash-command skill engine — including installing skills straight from GitHub.
SYSTEM_PROMPT.mdBehavior
GAIA's full behavioral prompt: identity, tool philosophy, dependency & version rules, security, and the Claude Code engineering philosophy.
MEMORY_ENGINE.mdMemory + planning
Persistent memory (MEMORY.md) that survives auto-compaction, plus the plan engine (PLAN.md + TASKS.md) with per-task checkboxes.
TURN_ENGINE.mdTurns + budget
Context-budget estimation so a turn never overflows, a 15-call tool budget, and size-aware commit batching.
// The four engines
NOT A PROMPT. A SYSTEM.
Each file drives one engine. Together they let GAIA remember, plan, pace itself, and run your skills.
Survives auto-compaction.
GAIA keeps a MEMORY.md in its sandbox — project structure, your standing notes, and observations it records itself. On first contact with a repo it reads the project's CLAUDE.md and AGENTS.md and seeds memory with its structure and conventions. It re-reads memory after every compaction and writes down mistakes it fixed so it never repeats them.
Explore. Plan. Approve. Execute.
Non-trivial work starts as a written PLAN.md you approve before a line is touched. Execution is tracked in TASKS.md with checkboxes flipped the moment each task lands — never batched at the end.
Never overflows the window.
Before generating, GAIA estimates the token cost of a turn and stops at a safe boundary, so Perplexity doesn't crash mid-task. Commits are batched by file size for clean, reliable history.
Slash-command skills.
Drop a skill file into the Space and call it with a slash command (e.g. /humanizer) — or install one straight from a GitHub repo. GAIA adapts external, non-ported skills to the tools it actually has.
// How a turn runs
EXPLORE → PLAN → EXECUTE.
GAIA doesn't just answer — it works in a disciplined loop, the same one Claude Code uses.
Explore
GAIA reads MEMORY.md, the repo's CLAUDE.md and AGENTS.md, and the code before touching anything, rebuilding context after every auto-compaction.
Plan
Non-trivial work becomes a written PLAN.md and TASKS.md you approve before a single line is generated.
Execute
It works task-by-task within a 15-call tool budget, flipping each TASKS.md checkbox the moment that task lands.
Commit
Changes are batched by file size and self-reviewed for the errors a build would catch before anything is pushed.
// Permission modes
ASK. ACCEPT. OR BYPASS.
Choose how GAIA handles approval. Ask Permissions checks in before every write; Accept Edits frees routine writes but gates merges and your default branch; Bypass runs hands-off. The mode is saved to MEMORY.md, so it holds across auto-compaction.
Ask Permissions
DefaultApprove every write.
GAIA pauses for your approval before any tool call that changes external state — commits, pushes, PRs, issues, merges. Read-only calls run freely. This is the default until you choose otherwise.
Accept Edits
Daily driverRoutine writes flow, risky ones ask.
GAIA commits, pushes branches, and opens PRs without stopping — but still asks before merging a PR, creating a repo, or writing to your default branch. Switch with /accept-edits.
Bypass Permissions
Hands-offNo prompts, full speed.
GAIA runs every tool call without asking. Switch on with /dangerously-skip-permissions and back with /ask-permissions — the choice is saved to MEMORY.md, so it survives auto-compaction.
// File reference
THE FOUR FILES
SYSTEM_INSTRUCTIONS.mdpastePasted into the Space Instructions field. Switches GAIA on, points it at the other three files, and hosts the slash-command skill engine — including installing skills straight from GitHub.
SYSTEM_PROMPT.mduploadGAIA's full behavioral prompt: identity, tool philosophy, dependency & version rules, security, and the Claude Code engineering philosophy.
MEMORY_ENGINE.mduploadPersistent memory (MEMORY.md) that survives auto-compaction, plus the plan engine (PLAN.md + TASKS.md) with per-task checkboxes.
TURN_ENGINE.mduploadContext-budget estimation so a turn never overflows, a 15-call tool budget, and size-aware commit batching.
// Questions
ARCHITECTURE FAQ
GAIA Code is a four-file prompt system that runs inside a Perplexity Space. It brings Claude Code's engineering workflow — persistent memory, a plan engine, context-budgeted turns, and a slash-command skill engine — into a Perplexity conversation.
// Deploy it
READY TO DEPLOY?
One gate, three engines. Have GAIA Code running in your Perplexity Space in minutes.