Agent system

From gridaco/grida · View interactive version

Agent system is an AI agent skill from the GitHub repository gridaco/grida. Grida AI agent system work: the native Rust agent (`crates/agent-kit-*`, `grida-agent-master`, the `grida-agent` host executable), its Desktop Main integration (`desktop/src/main/native-*`) and renderer chat controllers (`editor/lib/agent-chat/native-*`), plus the retained host services — `@grida/da

How to use this skill

Skill file

Grida Agent System

Chat execution and strategy run in the native Rust agent. The TypeScript

agent engine is gone; @grida/ai-host is now a retained media-services package

with no chat loop, sessions, prompts, skills or tool assembly. Desktop still

owns its client presentation, shell integration, and application preferences.

Do not recreate an execution engine or product master there.

Use CODE0 for Electron shell work. Adjacent:

CODE0 for GRIDA-SEC-004/006/008/014,

CODE0 for protocol changes between host and

Desktop.

Start here

Before selecting implementation files, read the canonical

architecture rings and placement rules,

then the native package mapping and checked dependency budgets.

Record the behavior's owner, execution surface, retained-state owner, and

affected contracts. Application behavior outside the rings is a valid result;

an agent feature does not automatically need a core change.

Keep the definitions in that WG section and the concrete budgets in the native

binding. Link to those owners rather than copying their rules into skills,

local instructions, or feature implementations. For a boundary change,

identify each side's contract and required evidence before editing either side.

Run the dependency guard when changing agent manifests or dependency budgets.

Topology

Desktop renderer  (editor/lib/agent-chat/native-*-controller.ts)
   │ guarded native chat IPC
Electron Main     (desktop/src/main/native-*.ts)
   │ supervises over private stdio: ACP + negotiated extensions,
   │ supervised provider HTTP (Main injects Gateway/ChatGPT credentials)
grida-agent       (crates/grida-agent — host composition, the executable)
   └ grida-agent-master  product policy: context, effort, goals, questions,
   │                     subagents, hooks, compaction accounts
   └ agent-kit-{core,runtime,sessions,providers,sandbox,store-sqlite}

Retained media sidecar (ServicesSidecar) — separate child of Main, runs no chat
   DaemonServer (@grida/daemon) + media tenant (@grida/ai-host/media-server)

Crate ownership and cross-crate rules:

CODE0.

Wire: CODE0.

Tool ownership across Rust/Electron/MCP:

CODE0.

Feature status: CODE0.

Non-obvious facts

Follow the current native continuation contract

before changing selection or recovery. Do not impose a chat-lifetime

connection lock or silently rebind accepted work.

host under the same execution; a rename always wins (catalogue revision).

agent-kit-sandbox confinement (Seatbelt / bubblewrap + seccomp); unavailable

confinement refuses the command with no unconfined fallback. Explicit

user-selected Full access uses its separate UnconfinedScope, retaining

process ownership without filesystem/network isolation. See the native

sandbox binding for exact guarantees. Windows starts no chat engine.

(workspaces/<key>/, documents/<key>/runtime/), one SQLite

agent.sqlite per state directory with one owning process. The store opens

only an empty database or its own recognized schema and profile. See the

SQLite opening and upgrade rules. The earlier

TypeScript sessions.db and its session scratch stay in place, denied to

the retained sidecar; never reopen them.

listener and transfers connected sockets; every route needs Basic Auth in

the Authorization header (no query-string credential), plus Referer and

Origin. @grida/daemon is AI-free by contract

(packages/grida-daemon/src/__boundary__.test.ts); the tenant list is static.

@grida/ai-host/chatgpt-host; the sidecar mounts no ChatGPT route and the

native host receives only an opaque scope (GRIDA-SEC-008).

shared provider credential file (GRIDA-SEC-014), denied to restricted model

commands. Explicit Full access relinquishes same-user file isolation; it

does not automatically inject provider credentials.

Where tests go

built-process cases under crates/grida-agent/tests/process/.

starts, routes and authorizes; do not duplicate crate behavior.

media routes: packages/grida-ai-host/src/**.

CODE0.

Verification

cargo test -p grida-agent --locked --test dependency_boundaries
cargo fmt --all --check
cargo clippy --workspace --all-targets --all-features --locked -- -D warnings
cargo test --workspace --all-features --locked

pnpm --filter @grida/daemon test          # + test:browser for the perimeter
pnpm --filter @grida/ai-host test

Headless end-to-end runs use grida-agent run (see the crate README) or the

mission runner in scripts/agent-missions/; both spend real model credits, so

run them only when asked. Desktop changes also need the desktop skill's

checks.

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.