Repository navigation
LOU-Y5: filesystem agent loader (loadAgentDir) - #66
Merged
Merged
Conversation
Define an agent as a directory: instructions.md, optional agent.ts/js/json/yaml config, tools/*.ts|js (defineTool exports), skills/ (loadSkills layouts) and subagents/<name>/ (recursive). loadAgentDir() assembles createAgent() options and returns exactly what createAgent() returns; resolveAgentDir() returns the options plus a manifest. Overrides win over files. Validation errors carry file paths: missing instructions, tool files with no usable export (with a defineTool example), duplicate tool names (both files), unknown config keys with did-you-mean, sub-agents without a description. A .ts file imported without a TS loader gets an error explaining the fix. Sub-agents are wired as delegate_to_<name> tools because createAgent has no subagents option on main yet. Adds docs/agent-directories.md, examples/agent-dir, the example:agent-dir script and a fallow dynamicallyLoaded glob for fixtures. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
loadAgentDir(dir, overrides?)andresolveAgentDir(dir, overrides?), exported from the root. An agent is a directory:instructions.md, optionalagent.ts|js|json|yaml,tools/*.ts|js(defineTool exports),skills/(loadSkills layouts),subagents/<name>/(recursive). Alsodocs/agent-directories.md,examples/agent-dir/(+example:agent-dirscript, README entries).Why
Filesystem-first onboarding like eve, but the typed code API stays the source of truth: the loader compiles to the same
createAgent()call, so users can move from files to code without a rewrite.How verified
Merged origin/main (10f2d24, LOU-D3) before the final run:
npx tsc --noEmitclean;npm run lint0 errors (433 warnings, same as main, none new from this change)npm run build+ create-loushy-agent build OKnpm run test:coverage: 122 files passed;npm run fallowexit 0npm run test:types3 files / 10 tests passed;docs:verify-snippets61 snippets OK;docs:llms:checkexit 0npx tsx examples/agent-dir/index.tsruns offline under real tsx (so real-Node dynamic import of .ts works)Notes for reviewer
createAgenthas nosubagentsoption on main yet, so each sub-agent dir becomes adelegate_to_<name>tool that calls the child agent'ssend()(notcreateDelegateTool, which needs anAgentConfigand would duplicate createAgent). Follow-up: switch to the native option once LOU-Y3 lands.loushy devis synchronous and bound toloadSpec/fs.watchon one file; accepting a directory needs async loading plus recursive watching, not a small change..fallowrc.json: addeddynamicallyLoadedglobs for the fixture and example tool files.tools/skillsreplace discovered ones; a file'sprovider/modelstring is dropped whenprovideris overridden.🤖 Generated with Claude Code