- Use
bun runfor scripts defined in package.json - Use
bunxfor one-off commands (e.g.,bunx tsx script.ts) - Use
bun testfor running tests - Use
bun build --compilefor creating standalone binaries
Always use bun for package management, never npm or yarn.
# Add dependencies
bun add <package>
# Install all dependencies
bun install
# Remove dependencies
bun remove <package>Using bun ensures:
- Faster installs
- Proper lockfile format
- Bun-native package resolution
# Run the agent
bun run src/agent.ts "write a CLI tool in Rust"
# Run tests
bun test
# Compile to binary
bun build src/agent.ts --compile --outfile zen-agentUse wide, canonical event logging throughout the codebase. Log:
- Tool invocations with inputs/outputs
- Agent decisions and reasoning
- Errors with context and stack traces
- Significant state transitions
Logs should be structured, machine-parseable, and include timestamps when possible.
Example:
console.log(`[tool:${tool}]`, payload);
console.log(`[agent] Goal: ${goal}, Step: ${i}`);
console.error(`[error]`, { error, context });Non-comprehensive smoke tests are encouraged. Focus on:
- Happy path verification
- Critical error handling
- Interface contracts
Avoid over-specifying behavior. Test that things work, not how they work.