AgenTopology

Import

Reverse-engineer existing platform files into an .at topology

Import

import { importFromPlatform } from "agentopology";

Import reads existing platform configuration files and reverse-engineers them into an .at topology file. This is the inverse of scaffolding — instead of generating platform files from a topology, it creates a topology from platform files.

Supported platforms

BindingWhat it reads
claude-code.claude/ directory — agents, skills, settings, hooks
openclawOpenClaw workspace — openclaw.json, SOUL.md, AGENTS.md, skills, memory

CLI usage

agentopology import --target claude-code --dir .claude/
agentopology import --target openclaw --dir ~/my-openclaw-project/

The CLI reads all files from the specified directory, constructs a topology AST, serializes it to .at format, and writes the output file. It also runs validation on the result.

Programmatic usage

import { importFromPlatform } from "agentopology";
import { readdirSync, readFileSync } from "fs";
import { join } from "path";

// Read all files from the platform directory
function readFiles(dir: string): Array<{ path: string; content: string }> {
  const files: Array<{ path: string; content: string }> = [];
  for (const entry of readdirSync(dir, { withFileTypes: true, recursive: true })) {
    if (entry.isFile()) {
      const fullPath = join(entry.parentPath ?? entry.path, entry.name);
      const relativePath = fullPath.slice(dir.length);
      files.push({ path: relativePath, content: readFileSync(fullPath, "utf-8") });
    }
  }
  return files;
}

const files = readFiles(".claude/");
const atSource = importFromPlatform(files, "claude-code", "my-topology");
console.log(atSource);

How it works

Claude Code import

Reads the .claude/ directory structure:

  • agents/*/AGENT.md — Agent definitions with frontmatter (model, tools, permissions) and markdown body (role, instructions, reads/writes, outputs)
  • skills/*/SKILL.md — Topology-level skill with flow edges, gates, and triggers
  • settings.json — Tool allow/deny lists and hooks
  • .mcp.json — MCP server configurations
  • commands/*.md — Trigger definitions

OpenClaw import

Reads the OpenClaw workspace:

  • openclaw.json — Agent list, models, providers, tools settings, environment variables
  • SOUL.md — Topology identity, version, patterns, roles, parameters, triggers, interface endpoints
  • AGENTS.md — All agent definitions, group chats, flow edges, gates, schedules, hooks
  • skills/*/SKILL.md — Skill definitions with YAML frontmatter
  • MEMORY.md — Workspace and domain memory structure
  • cron/jobs.json — Scheduled job definitions (fallback)

Round-trip fidelity

Import is designed to preserve as much information as possible. For the best results:

  1. Scaffold first — If you scaffold a topology to a platform and then import it back, the result should be semantically equivalent to the original.
  2. Validate after import — Always run validation on the imported topology to catch any structural issues.
  3. Some fields may be lost — Platform-specific extensions, schemas, and defaults blocks may not survive the round-trip if the binding doesn't emit them.

On this page