Part 2 — The AI-Native Architecture
when your codebase is the prompt
// Any helper can explain itself at runtime const fs = container.feature('fs') fs.introspect() // full API: methods, state shape, events fs.introspectAsText() // human-readable docs fs.introspectAsType() // TypeScript interface // Discover everything available container.features.available // what exists container.features.describe() // what each one does
container.features.available
container.feature('git').introspect()
container.git.branch → writes code against it
// Any feature can expose itself to an AI assistant const git = container.feature('git') const { schemas, handlers } = git.toTools() // schemas → OpenAI-compatible function definitions // handlers → the actual implementations // Give an assistant access to any feature assistant.use(container.feature('fs')) assistant.use(container.feature('git')) assistant.use(container.feature('proc'))
assistants/researcher/ ├── CORE.md system prompt ├── tools.ts Zod-schema tools ├── hooks.ts lifecycle hooks └── docs/ auto-injected context
const asst = container .feature('assistant') // Give it any feature as tools asst.use(container.feature('fs')) asst.use(container.feature('git')) const reply = await asst.ask( 'What changed this week?' )
Normally, the more AI writes, the less confident you feel. With Luca, AI composes with helpers you've already reviewed. New code gets captured into new helpers. The codebase grows more trustworthy.
// An agent monitors the system in real-time container.on('featureEnabled', (id) => { agent.log(`Feature ${id} came online`) }) server.state.observe((type, key, val) => { if (key === 'requestCount' && val > 1000) agent.alert('Traffic spike detected') }) // Same primitives that power the UI, power the agent
What's available? What can it do? Ask and the container answers.
Every method, every event, every state shape — queryable at runtime.
Watch anything change. React without polling. Same as React, but headless.
Run code, see results, iterate. The agent loop IS the REPL loop.
github.com/soederpop/luca