Docs

Own Your Agents · 02.02

Bring Your Agents: The Import Pipeline

How Agentis discovers and imports agents you already run in Claude Code, Codex, Cursor, Antigravity, Hermes, and OpenClaw — identity, memory, and skills, pre-connected.

ImportHarness

Your agent already has a memory. It's just scattered.

An agent you already run through a CLI harness isn't empty-handed — it has accumulated real knowledge in files the harness reads at startup: CLAUDE.md, AGENTS.md, .cursorrules, GEMINI.md, and whatever project- or user-level instruction files that runtime uses. Import doesn't ask you to re-teach an agent what it already knows. It reads those files, distills the durable statements out of the boilerplate, and writes them into the agent's private Brain.

Discover, then import
const found = await agentis.agents.discover_import();   // scans local harnesses
await agentis.agents.import({ agents: found.result.agents });   // identity + memory + skills

The distillation quality gate

Raw instruction files are mostly boilerplate — headings, code fences, installation steps, table-of-contents noise. A deterministic scorer walks every line and drops anything below a 0.55 quality threshold (DEFAULT_MIN_QUALITY) before it's even offered as a candidate. The scorer isn't a model call — it's fast, free, and repeatable:

SignalEffect on score
Under 4 words, or a bare URL, or a table separatorHard reject — quality 0
Rule cues: "always", "never", "must", "don't", "prefer"+0.22 — the highest-value harness knowledge
Decision cues: "we chose", "decided to", "trade-off"+0.15, classified as a decision episode
Concrete specifics: a path, a flag, a function() reference+0.12
Sits under a heading like "Conventions" or "Architecture"+0.10
Starts with "this", "note that", "for example" — filler−0.10
Contains "TODO", "TBD", "WIP", "placeholder"−0.30

Every surviving line becomes a candidate atom classified into a memory type — decision, failure, success_pattern, or distilled_lesson by default — and tagged with a suggested trust score derived from where it came from (an operator-authored project file is trusted more than a machine-global runtime default).

Idempotent by construction

Import is designed to be run more than once without ever polluting the Brain. Two independent dedup layers make that safe:

  • Exact. Every candidate carries a content hash. Re-scanning an unchanged file produces the same hashes, which are recognized as already-imported and skipped — no new episode, no duplicate.
  • Semantic. A paraphrase of something already in the Brain — same idea, different words — is caught by an embedding similarity search at a 0.82 cosine threshold. Instead of writing a near-duplicate, the existing episode is reinforced: its confidence and trust nudge upward, exactly as if the same lesson had been independently confirmed.

At the agent level, idempotency works the same way: the imported agent's config.importOrigin stores the external ID it came from, so importing "the same" Claude Code agent twice reuses the existing Agentis agent rather than creating a second one.

This is also what makes continuous import safe. checkImportUpdates re-scans already-imported agents and reports only genuinely new atoms; syncImportedAgents commits just that delta. You can pull from a harness's growing memory on a schedule without re-reviewing everything each time.

Where an atom lands: agent-private vs. workspace-shared

Not every imported statement belongs to one agent. A convention scoped to how this specific agent should behave lands in its private Brain (scopeId = agentId); a rule that applies to the whole team lands in the shared workspace Brain (scopeId = null). Import carries a scope hint per candidate so this routing happens automatically instead of dumping everything into one bucket.

Skills come along too

A harness's SKILL.md files transition into agent-scoped Brain skill atoms — Living Skills — through the same import call. Re-importing a skill with the same name upserts it in place rather than duplicating it; marketplace/vendor skills are opt-in only, while the operator's own project and user skills are included by default.

Continue