TypeAgent / powershell
CLAUDE.md745 starsChanged 5 months agoMITView on GitHub
PowerShell captures and reuses PowerShell scripts from reasoning traces. Scripts persist in instance storage (~/.typeagent/profiles/<profile>/powershell/) across sessions. Grammar rules are registered dynamically at runtime — no build step needed for user-created flows. scripts/compileRecipes.mjs reads pending/*.recipe.json and generates build-time artifacts. This is useful for testing but not used in production — production flows are loaded from instance storage at runtime.
In this repository11 other files it gives its agents.
- ts/packages/agents/onboarding/AGENTS.mdAGENTS.md
- 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/taskflow/CLAUDE.mdCLAUDE.md
- dotnet/autoShell/.github/copilot-instructions.mdCopilot instructions
- .github/copilot-instructions.mdCopilot instructions
- typeagent-memorySkill
- typeagent-macrosSkill
- typeagent-setupSkill
The file
Files
PowerShell Agent — Claude Code Instructions
PowerShell captures and reuses PowerShell scripts from reasoning traces.
Scripts persist in instance storage (~/.typeagent/profiles/<profile>/powershell/)
across sessions. Grammar rules are registered dynamically at runtime — no build
step needed for user-created flows.
Architecture
- Instance storage: flows + scripts persist across sessions via
SessionContext.instanceStorage - Runtime grammar registration:
.agrrule text →globalAgentGrammarRegistry.addGeneratedRules() - Sample seeding:
samples/*.recipe.jsonare copied to instance storage on first activation - Build-time compilation (
compileRecipes.mjs): only for developer workflow, not production
Storage Layout (in instance storage)
powershell/
├── index.json # Flow registry index
├── flows/
│ └── listFiles.flow.json # Flow metadata + parameters + sandbox
├── scripts/
│ └── listFiles.ps1 # Separated PowerShell script
└── pending/
└── *.recipe.json # Captured from reasoning, not yet promotedLifecycle
updateAgentContext(enable=true)→ init store → seed samples → register grammars- Grammar matcher routes to powershell agent on match
executeActionlooks up flow from store → reads.ps1→ executes in sandbox- Reasoning traces with PowerShell →
ScriptRecipeGenerator→ saved topending/
Script Recipe Format
{
"version": 1,
"actionName": "camelCaseActionName",
"description": "what this script does",
"displayName": "Human Readable Name",
"parameters": [
{
"name": "path",
"type": "path",
"required": false,
"description": "Directory to list",
"default": "."
}
],
"script": {
"language": "powershell",
"body": "param([string]$Path = '.')\nGet-ChildItem -Path $Path",
"expectedOutputFormat": "table"
},
"grammarPatterns": [
{
"pattern": "list files in $(path:wildcard)",
"isAlias": false,
"examples": ["list files in downloads"]
},
{
"pattern": "ls $(path:wildcard)",
"isAlias": true,
"examples": ["ls downloads"]
}
],
"sandbox": {
"allowedCmdlets": ["Get-ChildItem", "Select-Object"],
"allowedPaths": ["$env:USERPROFILE", "$PWD", "$env:TEMP"],
"allowedModules": ["Microsoft.PowerShell.Management"],
"maxExecutionTime": 30,
"networkAccess": false
}
}Key Differences from TaskFlow Recipes
- Uses
script.body(PowerShell) instead ofstepsarray of agent actions - Has
sandboxpolicy (cmdlet whitelist, path restrictions, timeout) grammarPatternsare objects withisAliasflag, not plain strings- Parameter type can be
"path"(validated as filesystem path) - Stored in instance storage, not in the package directory
Grammar Pattern Syntax
- Captures:
$(varName:wildcard)for strings/paths,$(varName:number)for numbers - Optional tokens:
(word)? - Alternatives:
(this | that) isAlias: truefor terse shell-like forms (ls, dir, ps)
Build-time Compilation (developer workflow only)
pnpm run compilescripts/compileRecipes.mjs reads pending/*.recipe.json and generates build-time
artifacts. This is useful for testing but not used in production — production flows
are loaded from instance storage at runtime.
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.

