Skip to content

LOU-Y5: filesystem agent loader (loadAgentDir) - #66

Merged
LinuxDevil merged 3 commits into
mainfrom
lou-y5-agent-dir-loader
Oct 1, 2026
Merged

LinuxDevil merged 3 commits into
mainfrom
lou-y5-agent-dir-loader

Conversation

@LinuxDevil

Copy link
Copy Markdown
Owner

What

loadAgentDir(dir, overrides?) and resolveAgentDir(dir, overrides?), exported from the root. An agent is a directory: instructions.md, optional agent.ts|js|json|yaml, tools/*.ts|js (defineTool exports), skills/ (loadSkills layouts), subagents/<name>/ (recursive). Also docs/agent-directories.md, examples/agent-dir/ (+ example:agent-dir script, 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 --noEmit clean; npm run lint 0 errors (433 warnings, same as main, none new from this change)
  • npm run build + create-loushy-agent build OK
  • npm run test:coverage: 122 files passed; npm run fallow exit 0
  • npm run test:types 3 files / 10 tests passed; docs:verify-snippets 61 snippets OK; docs:llms:check exit 0
  • npx tsx examples/agent-dir/index.ts runs offline under real tsx (so real-Node dynamic import of .ts works)

Notes for reviewer

  • Sub-agents: createAgent has no subagents option on main yet, so each sub-agent dir becomes a delegate_to_<name> tool that calls the child agent's send() (not createDelegateTool, which needs an AgentConfig and would duplicate createAgent). Follow-up: switch to the native option once LOU-Y3 lands.
  • CLI left alone: loushy dev is synchronous and bound to loadSpec/fs.watch on one file; accepting a directory needs async loading plus recursive watching, not a small change.
  • .fallowrc.json: added dynamicallyLoaded globs for the fixture and example tool files.
  • Overrides: tools/skills replace discovered ones; a file's provider/model string is dropped when provider is overridden.

🤖 Generated with Claude Code

LinuxDevil and others added 3 commits October 1, 2026 10:36
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>
@LinuxDevil
LinuxDevil merged commit cc54f35 into main Oct 1, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant