AI coding agent instructions for @nanocollective/nanocoder
A local-first CLI coding agent that brings the power of agentic coding tools like Claude Code and Gemini CLI to local models or controlled APIs like OpenRouter
Project Type: React Web Application Primary Language: TypeScript (99% of codebase)
Key Frameworks & Libraries:
- React (^19.0.0) - web
Project Structure:
assets/- Static assetsdocs/- Documentationsource/- Source code.github/assets/- Static assetsdocs/configuration/- Project filesdocs/features/- Project filesdocs/getting-started/- Project filessource/ai-sdk-client/- Project filessource/app/- Application codesource/auth/- Project filessource/commands/- Project filessource/components/- React/UI componentssource/config/- Configuration filessource/context/- Project filessource/custom-commands/- Project filessource/hooks/- Project filessource/init/- Project filessource/lsp/- Project filessource/markdown-parser/- Project filessource/mcp/- Project files
Configuration:
package.json- Node.js dependencies and scriptsplugins/vscode/package.json- Node.js dependencies and scriptspnpm-lock.yaml- Configuration file
Documentation:
docs/**.mdREADME.md.devcontainer/README.md.github/ISSUE_TEMPLATE/bug_report.md.github/ISSUE_TEMPLATE/feature_request.md
Build:
npm run buildDevelopment:
npm run devStart:
npm run start- Use camelCase for variables and functions
- Use PascalCase for classes and components
- Prefer const/let over var
- Use async/await over callbacks when possible
- Use functional components with hooks
- Follow React naming conventions for components
Test Files:
.nanocoder/commands/test.mdscripts/test-copilot.shscripts/test.shsource/ai-sdk-client/ai-sdk-client.spec.tssource/ai-sdk-client/chat/chat-handler.spec.ts
The following guidelines were found in existing AI configuration files:
From CLAUDE.md:
pnpm run build # Compile TypeScript to dist/ with executable permissions pnpm run build:credits # Regenerate contributors.json from git history (CI/release only) pnpm run start # Run the compiled application pnpm run dev # Watch mode compilation (tsc --watch)
pnpm run test:all # Full suite: format, lint, types, AVA tests, knip
Nanocoder is a React-based CLI coding agent built with Ink.js that provides local-first AI assistance with multiple provider support (Ollama, OpenRouter, any OpenAI-compatible API).
Entry point: source/cli.tsx → Ink render of App from source/app.tsx
All state lives in useAppState.tsx. Other hooks (useChatHandler, useToolHandler, useModeHandlers) receive state and setters from it. App.tsx orchestrates these hooks together. Global message-queue.ts allows deep components to add chat messages.
client-factory.ts creates clients via createLLMClient(provider?). Uses Vercel AI SDK with createOpenAICompatible for any OpenAI-compatible API. Supports streaming responses and tool calling.
- TypeScript strict mode with
@/*path alias mapping tosource/* - Biome for formatting (tabs, single quotes, semicolons, trailing commas)
- Key lint rules:
useExhaustiveDependencies: error,noUnusedVariables: error,noUnusedImports: error - React 19 with Ink.js for CLI rendering
- Framework: AVA with tsx loader
- Location:
source/**/*.spec.tsfiles alongside source - Serial execution: Tests run one at a time
- Run single test:
pnpm run test:ava source/path/to/file.spec.ts
Important Considerations:
- Check package.json for available scripts before running commands
- Be aware of Node.js version requirements
- Consider impact on bundle size when adding dependencies
- Follow React hooks best practices
- Consider component reusability when creating new components
- Project has 809 files across 93 directories
- Large codebase: Focus on specific areas when making changes
- Check build configuration files before making structural changes
Source: https://github.com/Nano-Collective/nanocoder.git
This AGENTS.md file was generated by Nanocoder. Update it as your project evolves.