agentleFS
MicrosoftKnown publishermicrosoft/TypeAgent/ts/packages/agents/taskflow/CLAUDE.md

TypeAgent / taskflow

CLAUDE.md745 starsChanged 5 months agoMITView on GitHub

TaskFlow runs user-taught multi-step macros over existing TypeAgent actions. Flows are pure JSON — no TypeScript logic. A deterministic compile script handles all boilerplate generation (TypeScript type, grammar rule, manifest entry). When asked to "compile pending recipes" or similar: That's it. scripts/compileRecipes.mjs reads pending/*.recipe.json and: If the build fails, fix the error in the generated files and re-run pnpm run build. When asked to write a recipe for a new flow (or if you notice a missing flow): Do NOT…

The file

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

8 rules. About 0 are common, 2 are distinctive, and 6 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈2

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 6

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    When asked to "compile pending recipes" or similar:

    line 11
  2. Very specific:

    If the build fails, fix the error in the generated files and re-run pnpm run build.

    line 26
  3. Distinctive:

    When asked to write a recipe for a new flow (or if you notice a missing flow):

    line 32
  4. Very specific:

    Use discover_actions to confirm exact schemaName + actionName + parameter types

    line 34
  5. Very specific:

    Write pending/ACTION_NAME.recipe.json using the format below

    line 36
  6. Very specific:

    Do NOT write TypeScript files.

    line 39
  7. Very specific:

    All return Promise<ActionStepResult> with { text, data, error?

    line 84
  8. Very specific:

    Use discover_actions schemaName to see exact parameter types.

    line 97

≈ “Common” is an estimate: at least 1 in 5 of the 12,729 CLAUDE.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
CLAUDE.md

TaskFlow Agent — Claude Code Instructions

TaskFlow runs user-taught multi-step macros over existing TypeAgent actions. Flows are pure JSON — no TypeScript logic. A deterministic compile script handles all boilerplate generation (TypeScript type, grammar rule, manifest entry).


Compiling Pending Recipes

When asked to "compile pending recipes" or similar:

pnpm run compile

That's it. scripts/compileRecipes.mjs reads pending/*.recipe.json and:

  1. Writes flows/ACTION_NAME.flow.json
  2. Appends TypeScript type to src/schema/userActions.mts
  3. Appends grammar rule to src/taskflowSchema.agr
  4. Updates manifest.json flows entry
  5. Runs pnpm run asc && pnpm run agc && npx tsc -b
  6. Moves processed recipes to pending/processed/

If the build fails, fix the error in the generated files and re-run pnpm run build.


Writing a Recipe

When asked to write a recipe for a new flow (or if you notice a missing flow):

  1. Use discover_actions to confirm exact schemaName + actionName + parameter types
  2. Devise the step sequence — keep it linear; each step's output feeds the next
  3. Write pending/ACTION_NAME.recipe.json using the format below
  4. Tell the user: "Recipe written — run pnpm run compile from packages/agents/taskflow"

Do NOT write TypeScript files. Do NOT edit userActions.mts, taskflowSchema.agr, manifest.json, or actionHandler.mts by hand — the compile script does all of that.


Recipe Format

Scripts must be written in TypeScript. The sandbox provides these types globally — do NOT add import statements.

{
  "name": "camelCaseActionName",
  "description": "what this flow does",
  "parameters": [
    {
      "name": "paramName",
      "type": "string | number | boolean",
      "required": true,
      "description": "shown in grammar and type"
    },
    {
      "name": "optionalParam",
      "type": "string",
      "required": false,
      "default": "default value",
      "description": "..."
    }
  ],
  "script": "async function execute(api: TaskFlowScriptAPI, params: FlowParams): Promise<TaskFlowScriptResult> {\n    const result = await api.webSearch(params.paramName);\n    return { success: true, message: result.text };\n}",
  "grammarPatterns": [
    "3-5 natural ways to invoke this, with $(param:wildcard) or $(param:number) captures"
  ]
}

Script API

The api parameter implements TaskFlowScriptAPI:

  • api.callAction(schemaName, actionName, params) — call any TypeAgent agent action
  • api.queryLLM(prompt, { input?, parseJson?, model? }) — LLM transform
  • api.webSearch(query) — web search
  • api.webFetch(url) — fetch a URL

All return Promise<ActionStepResult> with { text, data, error? }.

Grammar pattern syntax

  • Captures: $(varName:wildcard) or $(varName:number)
  • Optional tokens: (word)?
  • Alternatives within a pattern: (this | that)
  • Bare words only — no quotes around words

Available Actions for Flows

Use discover_actions schemaName to see exact parameter types. Key schemas:

utility — webSearch(query), webFetch(url), readFile(path), writeFile(path, content), llmTransform(input, prompt, parseJson?, model?), claudeTask(goal, parseJson?, model?, maxTurns?)

email — findEmail(messageRef), sendEmail(subject, body?, to[], genContent), replyEmail(...), forwardEmail(...)

player — music/Spotify actions (see discover_actions)

Note: sendEmail with to: ["me"] automatically resolves to the user's own email address. genContent: { generateBody: false } tells the handler to use the provided body as-is.


LLM Model Selection for llmTransform / claudeTask

TaskModel
Simple extraction, formatting, summarisationclaude-haiku-4-5-20251001
Complex multi-step reasoningclaude-sonnet-4-6

Default to Haiku.

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.