agentleFS
MicrosoftKnown publishermicrosoft/TypeAgent/ts/packages/agents/onboarding/AGENTS.md

TypeAgent / onboarding

AGENTS.md752 starsChanged 4 months agoMITView on GitHub

This document is for AI agents (Claude Code, GitHub Copilot, etc.) working with the onboarding agent codebase. The onboarding agent automates integrating a new application or API into TypeAgent. It is itself a TypeAgent agent, so its actions are available to AI orchestrators via TypeAgent's MCP interface using list_commands. onboardingActionHandler.ts exports instantiate() which returns a single AppAgent. The executeAction method receives all actions (from main schema and all sub-schemas) and dispatches by action.actionName to the appropriate phase handler module. All…

  • Reads credentials

The file

We split this AGENTS.md into the rules it gives an agent

10 rules. About 0 are common, 0 are distinctive, and 10 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈0

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 10

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    All artifacts are persisted at ~/.typeagent/onboarding/<integration-name>/.

    line 35
  2. Very specific:

    Create src/<phaseName>/ with *Schema.ts, *Schema.agr, *Handler.ts

    line 55
  3. Very specific:

    Add the sub-action manifest entry to onboardingManifest.json

    line 56
  4. Very specific:

    Add asc:* and agc:* build scripts to package.json

    line 57
  5. Very specific:

    Import and wire up the handler in onboardingActionHandler.ts

    line 58
  6. Very specific:

    Add the phase to the OnboardingPhase type and phases object in workspace.ts

    line 59
  7. Very specific:

    Add the action type to the phase's *Schema.ts

    line 63
  8. Very specific:

    Add grammar patterns to the phase's *Schema.agr

    line 64
  9. Very specific:

    After writing the schema sources, the scaffolder generates a committed <schema>.keywords.json beside each one — the "onboarding moment" of …

    line 121
  10. Very specific:

    Run phrase→action tests with the runTests action after completing the testing phase setup.

    line 135

≈ “Common” is an estimate: at least 1 in 5 of the 40,246 AGENTS.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
AGENTS.md

AGENTS.md — Onboarding Agent

This document is for AI agents (Claude Code, GitHub Copilot, etc.) working with the onboarding agent codebase.

What this agent does

The onboarding agent automates integrating a new application or API into TypeAgent. It is itself a TypeAgent agent, so its actions are available to AI orchestrators via TypeAgent's MCP interface using list_commands.

Agent structure

src/
  onboardingManifest.json       ← main manifest, declares 7 sub-action manifests
  onboardingSchema.ts           ← top-level coordination actions
  onboardingSchema.agr          ← grammar for top-level actions
  onboardingActionHandler.ts    ← instantiate(); routes all actions to phase handlers
  lib/
    workspace.ts                ← read/write per-integration state on disk
    llm.ts                      ← aiclient ChatModel factories per phase
  discovery/                    ← Phase 1: API surface enumeration
  phraseGen/                    ← Phase 2: natural language phrase generation
  schemaGen/                    ← Phase 3: TypeScript action schema generation
  grammarGen/                   ← Phase 4: .agr grammar generation
  scaffolder/                   ← Phase 5: agent package scaffolding
  testing/                      ← Phase 6: phrase→action test loop
  packaging/                    ← Phase 7: packaging and distribution

How actions are routed

onboardingActionHandler.ts exports instantiate() which returns a single AppAgent. The executeAction method receives all actions (from main schema and all sub-schemas) and dispatches by action.actionName to the appropriate phase handler module.

Workspace state

All artifacts are persisted at ~/.typeagent/onboarding/<integration-name>/. The workspace.ts lib provides:

  • createWorkspace(config) — initialize a new integration workspace
  • loadState(name) — load current phase state
  • saveState(state) — persist state
  • updatePhase(name, phase, update) — update phase status; automatically advances currentPhase on approval
  • readArtifact(name, phase, filename) — read a phase artifact
  • writeArtifact(name, phase, filename, content) — write a phase artifact
  • listIntegrations() — list all integration workspaces

LLM usage

Each phase that requires LLM calls uses aiclient's createChatModelDefault(tag). Tags are namespaced as onboarding:<phase> (e.g. onboarding:schemagen). This follows the standard TypeAgent pattern — credentials come from ts/config.local.yaml (or the legacy ts/.env).

Phase approval model

Each phase has a status: pending → in-progress → approved. An approve* action locks artifacts and advances to the next phase. The AI orchestrator is expected to review artifacts before calling approve — this is the human-in-the-loop checkpoint.

Adding a new phase

  1. Create src/<phaseName>/ with *Schema.ts, *Schema.agr, *Handler.ts
  2. Add the sub-action manifest entry to onboardingManifest.json
  3. Add asc:* and agc:* build scripts to package.json
  4. Import and wire up the handler in onboardingActionHandler.ts
  5. Add the phase to the OnboardingPhase type and phases object in workspace.ts

Adding a new tool to an existing phase

  1. Add the action type to the phase's *Schema.ts
  2. Add grammar patterns to the phase's *Schema.agr
  3. Implement the handler case in the phase's *Handler.ts

Key dependencies

  • @typeagent/agent-sdk — AppAgent, ActionContext, TypeAgentAction, ActionResult
  • @typeagent/agent-sdk/helpers/action — createActionResultFromTextDisplay, createActionResultFromMarkdownDisplay
  • aiclient — createChatModelDefault, ChatModel
  • typechat — createJsonTranslator for structured LLM output

Scaffolder — choosing a pattern

The scaffolder (Phase 5) generates pattern-appropriate boilerplate. Before calling scaffoldAgent, determine which pattern fits the integration being onboarded. The discovery phase artifacts should give you enough information to decide.

Decision guide

Signal from discoveryPattern to use
Integration streams text (chat, code gen, summarization)llm-streaming
Integration is a desktop/browser/Electron app with a JS runtimewebsocket-bridge
Integration is a long-running, multi-step process needing human sign-offstate-machine
API surface has 5+ distinct domains (e.g., files + calendar + mail)sub-agent-orchestrator
Integration needs a custom interactive UIview-ui
Integration has an authenticated REST or OAuth APIexternal-api
Integration is a CLI tool, mobile device, or OS servicenative-platform
Integration has only a few toggle/config actionscommand-handler
None of the aboveschema-grammar (default)

Scaffold with a pattern

scaffold the <name> agent using the <pattern> pattern

List all patterns

list agent patterns

Full pattern reference (file layouts, manifest flags, example code) is in docs/architecture/agents/agent-patterns.md.

What the scaffolder generates per pattern

  • schema-grammar — manifest, handler, schema, grammar, tsconfigs, package.json
  • external-api — above + *Bridge.ts with an API client class stub; adds aiclient dependency
  • llm-streaming — above + injected: true / cached: false / streamingActions in manifest; adds aiclient + typechat dependencies
  • sub-agent-orchestrator — above + actions/ directory with per-group schema and grammar stubs; subActionManifests in manifest
  • websocket-bridge — above + *Bridge.ts with a WebSocketServer + pending-request map; adds ws dependency
  • state-machine — above + state type definitions and loadState / saveState helpers
  • native-platform — above + child_process / platform-branching boilerplate
  • view-ui — above + openLocalView / closeLocalView lifecycle; localView: true in manifest
  • command-handler — replaces executeAction dispatch with a named handlers map

Keyword vectors (context-weighted collision resolution)

After writing the schema sources, the scaffolder generates a committed <schema>.keywords.json beside each one — the "onboarding moment" of the contextSelector keyword-vector lifecycle (see docs/architecture/collision/onboarding-keyword-generation-design.md). These vectors let the dispatcher route ambiguous requests to the new agent by what the conversation is about, without waiting for a @collision keywords backfill pass. Generation is best-effort: LLM distillation is preferred (folded into the phase's token accounting), the deterministic lexical floor is the fallback, and any failure is reported in the scaffold summary without blocking the phase. The scaffold result lists each generated keyword file with its distilled-vs-lexical counts.

Testing

Run phrase→action tests with the runTests action after completing the testing phase setup. Results are saved to ~/.typeagent/onboarding/<name>/testing/results.json. The proposeRepair action uses an LLM to suggest schema/grammar fixes for failing tests.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.