// 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.

1Gate
3Engine files
4Engines
15Tool calls / msg

// 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.

PASTE → SPACE INSTRUCTIONSSYSTEM_INSTRUCTIONS.md

The 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.

UPLOAD → SPACE FILESYSTEM_PROMPT.md

Behavior

GAIA's full behavioral prompt: identity, tool philosophy, dependency & version rules, security, and the Claude Code engineering philosophy.

UPLOAD → SPACE FILEMEMORY_ENGINE.md

Memory + planning

Persistent memory (MEMORY.md) that survives auto-compaction, plus the plan engine (PLAN.md + TASKS.md) with per-task checkboxes.

UPLOAD → SPACE FILETURN_ENGINE.md

Turns + 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.

Persistent Memory01

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.

Plan Engine02

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.

Turn Engine03

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.

Skill Engine04

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.

01

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.

02

Plan

Non-trivial work becomes a written PLAN.md and TASKS.md you approve before a single line is generated.

03

Execute

It works task-by-task within a 15-call tool budget, flipping each TASKS.md checkbox the moment that task lands.

04

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.

01

Ask Permissions

Default

Approve 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.

02

Accept Edits

Daily driver

Routine 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.

03

Bypass Permissions

Hands-off

No 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.mdpaste

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.mdupload

GAIA's full behavioral prompt: identity, tool philosophy, dependency & version rules, security, and the Claude Code engineering philosophy.

MEMORY_ENGINE.mdupload

Persistent memory (MEMORY.md) that survives auto-compaction, plus the plan engine (PLAN.md + TASKS.md) with per-task checkboxes.

TURN_ENGINE.mdupload

Context-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.