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
Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about code style.
Of the AGENTS.md files we read, the 31,774 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
In this repository11 other files it gives its agents.
- ts/packages/typeagent-core/AGENTS.mdAGENTS.md
- ts/packages/typeagent-studio/AGENTS.mdAGENTS.md
- ts/CLAUDE.mdCLAUDE.md
- ts/examples/planValidationDemo/CLAUDE.mdCLAUDE.md
- ts/packages/agents/powershell/CLAUDE.mdCLAUDE.md
- ts/packages/agents/taskflow/CLAUDE.mdCLAUDE.md
- dotnet/autoShell/.github/copilot-instructions.mdCopilot instructions
- .github/copilot-instructions.mdCopilot instructions
- typeagent-memorySkill
- typeagent-macrosSkill
- typeagent-setupSkill
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
- Very specific: line 35
All artifacts are persisted at ~/.typeagent/onboarding/<integration-name>/.
- Very specific: line 55
Create src/<phaseName>/ with *Schema.ts, *Schema.agr, *Handler.ts
- Very specific: line 56
Add the sub-action manifest entry to onboardingManifest.json
- Very specific: line 57
Add asc:* and agc:* build scripts to package.json
- Very specific: line 58
Import and wire up the handler in onboardingActionHandler.ts
- Very specific: line 59
Add the phase to the OnboardingPhase type and phases object in workspace.ts
- Very specific: line 63
Add the action type to the phase's *Schema.ts
- Very specific: line 64
Add grammar patterns to the phase's *Schema.agr
- Very specific: line 121
After writing the schema sources, the scaffolder generates a committed <schema>.keywords.json beside each one — the "onboarding moment" of …
- Very specific: line 135
Run phrase→action tests with the runTests action after completing the testing phase setup.
≈ “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.
Files
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 distributionHow 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 workspaceloadState(name)— load current phase statesaveState(state)— persist stateupdatePhase(name, phase, update)— update phase status; automatically advancescurrentPhaseon approvalreadArtifact(name, phase, filename)— read a phase artifactwriteArtifact(name, phase, filename, content)— write a phase artifactlistIntegrations()— 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
- Create
src/<phaseName>/with*Schema.ts,*Schema.agr,*Handler.ts - Add the sub-action manifest entry to
onboardingManifest.json - Add
asc:*andagc:*build scripts topackage.json - Import and wire up the handler in
onboardingActionHandler.ts - Add the phase to the
OnboardingPhasetype andphasesobject inworkspace.ts
Adding a new tool to an existing phase
- Add the action type to the phase's
*Schema.ts - Add grammar patterns to the phase's
*Schema.agr - 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,createActionResultFromMarkdownDisplayaiclient—createChatModelDefault,ChatModeltypechat—createJsonTranslatorfor 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 discovery | Pattern to use |
| Integration streams text (chat, code gen, summarization) | llm-streaming |
| Integration is a desktop/browser/Electron app with a JS runtime | websocket-bridge |
| Integration is a long-running, multi-step process needing human sign-off | state-machine |
| API surface has 5+ distinct domains (e.g., files + calendar + mail) | sub-agent-orchestrator |
| Integration needs a custom interactive UI | view-ui |
| Integration has an authenticated REST or OAuth API | external-api |
| Integration is a CLI tool, mobile device, or OS service | native-platform |
| Integration has only a few toggle/config actions | command-handler |
| None of the above | schema-grammar (default) |
Scaffold with a pattern
scaffold the <name> agent using the <pattern> patternList all patterns
list agent patternsFull 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.jsonexternal-api— above +*Bridge.tswith an API client class stub; addsaiclientdependencyllm-streaming— above +injected: true / cached: false / streamingActionsin manifest; addsaiclient+typechatdependenciessub-agent-orchestrator— above +actions/directory with per-group schema and grammar stubs;subActionManifestsin manifestwebsocket-bridge— above +*Bridge.tswith aWebSocketServer+ pending-request map; addswsdependencystate-machine— above + state type definitions andloadState/saveStatehelpersnative-platform— above +child_process/ platform-branching boilerplateview-ui— above +openLocalView/closeLocalViewlifecycle;localView: truein manifestcommand-handler— replacesexecuteActiondispatch with a namedhandlersmap
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.
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
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.

