Introduction
Astra is an AI-native development companion that brings secure, browser-aware agentic coding capabilities directly to your terminal. It gives an LLM full programmatic access to your filesystem, shell, and the web — all gated behind an interactive staging and approval pipeline that keeps you in control at all times.
Built on Bun, powered by OpenRouter, and leveraging the Vercel AI SDK ToolLoopAgent for autonomous, multi-step tool-driven workflows.
Package
astrabot
CLI Binary
astra
Version
0.1.7
Runtime
Bun >= 1.0.0
Language
TypeScript 5
License
MIT
LLM Provider
OpenRouter
Agent SDK
Vercel AI SDK
Note
Interaction Modes at a Glance
| Mode | Purpose | File Mutations |
|---|---|---|
| Auto | LLM-powered intent router -- picks the best mode for your request | Depends on route |
| Agent | Autonomous multi-step code modifications with browser control | Yes (staged) |
| Ask | Read-only Q&A about your codebase | No (except optional save) |
| Plan | Structured multi-step planning with selective execution | Yes (staged) |
| Multi-Agent | Multiple agents working in configurable topologies | Yes (staged) |
Quickstart
Get Astra up and running in under a minute.
Step 1: Install
npm install -g astrabotStep 2: Configure API Keys
Run the interactive setup wizard. It will prompt for your OpenRouter API key, let you search and select a model (with pricing), and optionally configure Firecrawl and custom skills directories.
astra setupStep 3: Navigate to Your Project
cd /path/to/your/projectStep 4: Use It
# Interactive menu
astra wakeup
# Direct auto-router execution
astra "fix the bug in store.ts"
# Ask a question (read-only)
astra "explain how the auth system works"Tip
npx astrabot "your goal here"Installation
Prerequisites
| Requirement | Version | Purpose |
|---|---|---|
| Bun | >= 1.0.0 | JavaScript / TypeScript runtime |
| OpenRouter API key | -- | LLM provider access (required) |
| Firecrawl API key | -- | Web search and crawling (optional) |
Option 1: Cross-Platform Installer (Recommended)
The installers automatically detect and install Node.js, Bun, and the astrabot npm package, then configure your PATH.
# Linux / macOS
bash install/install.sh
# Windows
install\install.batOption 2: Install Globally via npm
npm install -g astrabot
astra --version
npm update -g astrabot
npm uninstall -g astrabotOption 3: Run Directly with npx (No Installation)
npx astrabot setup
npx astrabot wakeup
npx astrabot "explain how this works"Option 4: Install from Source
git clone https://github.com/OneDev-Harsh/astra-cli.git
cd astra-cli
bun install
bun run index.ts setupCommands
Astra uses commander@^15.0.0 for CLI argument parsing. Every command is available as a subcommand of the astra binary.
astra [prompt...] default
The default action. With a prompt, it classifies intent via the auto-router and dispatches to the best mode. Without a prompt, it falls back to the interactive wakeup menu.
astra "fix the bug in store.ts"
astraThe auto-router uses fast-path regex for common patterns and falls back to an LLM classifier with temperature: 0. On classification failure, it defaults to agent mode.
astra wakeup
Launches the interactive menu with an animated ASCII art banner. Before showing the mode selector, it checks for interrupted sessions and offers to resume them.
- Renders ASCII banner using figlet with "ANSI Shadow" font (falls back to "Standard")
- Banner displayed in gold (#ffd000) with version and tagline
- Session resume check: looks for sessions with status === "interrupted"
- Mode selection via @clack/prompts select: CLI, Exit
astra setup
Interactive configuration wizard. Prompts for all required and optional settings and saves them to ~/.astra/.env.
- OpenRouter API key input
- Model selection -- fetches available models from OpenRouter API with search and pricing display
- Optional Firecrawl API key
- Optional custom skills directories (semicolon-separated paths)
Tip
astra setup at any time to update your configuration. Existing values are preserved and merged.astra sandbox
Activates sandbox mode -- a secure execution environment with OS keychain credential storage and HMAC-signed server communication. Uses the fixed model openrouter/owl-alpha.
- Health check the sandbox server
- Generate a secure random 32-byte hex auth token
- Bootstrap with the server (POST /bootstrap)
- Validate and sanitize the returned API key
- Store credentials in OS keychain (or AES-256-GCM encrypted file fallback)
- Set ASTRA_SANDBOX_ENABLED=true
astra play
Launches the arcade -- a game selector with 6 HTML5 Canvas mini-games. Spawns a local Bun HTTP server on port 4321 and opens your default browser.
| Game | File |
|---|---|
| Retro Snake Classic | index.html |
| Neon Brick Breaker | neon-breaker.html |
| Neon Pong | neon-pong.html |
| Neon Memory | neon-memory.html |
| Neon Tetris | neon-tetris.html |
| Neon Rush | neon-rush.html |
astra reset destructive
Purges all stored configurations, sessions, and credentials from ~/.astra/. Requires explicit confirmation via interactive prompt.
Warning
Interaction Modes
Astra provides five distinct interaction modes, each designed for a different development workflow. All modes use streaming output with real-time token telemetry.
Auto Mode
An LLM-based intent classifier that routes your request to the best mode automatically. Uses fast-path regex for common patterns before falling back to the LLM.
| Input Pattern | Routed To |
|---|---|
| "fix the bug in store.ts" | agent |
| "explain how this app works" | ask |
| "design a new authentication system" | plan |
| "run a security audit" | multi |
Falls back to agent on classification failure. Uses temperature: 0 for deterministic classification.
Agent Mode
The primary autonomous coding mode. Full tool access, multi-step file modifications, shell commands, web research, and complete browser control. All mutations staged and presented for approval with unified diffs. Up to 50 tool-calling steps per run.
- Goal input from user
- Initialize with defaultAgentConfig() (1 MB file size limit, exclude patterns, all tool permissions enabled)
- Begin session with workspace path, mode "agent", and goal; load ASTRA.md project conventions context automatically
- Construct ToolLoopAgent with stopWhen: stepCountIs(50)
- Execute via agent.stream() with per-step logging and token telemetry
- Auto-retry on error, with manual retry fallback
- Render final response as markdown in terminal
- Run approval flow for staged changes
- Apply approved changes to disk and record to persistent history log in real-time
- End session -- generate LLM summary, persist to disk, sync action history
Ask Mode
Read-only Q&A. The agent can read files, search the codebase, and browse the web, but cannot modify files (except optionally saving the response as a .md file). Up to 25 reasoning steps.
- All mutation permissions disabled (allowShellExecution, allowFileModification, allowFileCreation, allowFolderCreation)
- Mutation tools stripped; keeps read-only tools + web tools + session tools
- Answer rendered as markdown in terminal
- Optional save to .md file with ## Question / ## Answer headings
Plan Mode
Breaks a high-level goal into a structured plan with 1-20 steps, each with complexity ratings. You select which steps to execute; each runs as an independent agent. All changes are batched for a single approval review.
- Goal input from user
- Plan generation via Output.object() with Zod schema (researchSummary + steps[])
- Display plan -- numbered steps with color-coded complexity (low=green, medium=yellow, high=red)
- Step selection via @clack/prompts multiselect (all pre-selected)
- Each selected step runs as independent ToolLoopAgent (50 steps max)
- Single runApprovalFlow() for all changes across all steps
Multi-Agent Mode
Coordinates multiple AI agents working together. The LLM analyzes your goal and either selects a pre-built template or designs a custom agent team. Supports 5 orchestration strategies and per-agent model overrides.
- LLM selects from 6 pre-built workflow templates or designs a custom topology
- 10+ validation checks before execution
- Each agent gets role-based tool subset and permissions
- Per-agent approval flow with diff viewing
- Real-time event handling during execution
Tool System
Astra exposes 60+ typed tools to the AI agent via the Vercel AI SDK. Each tool is defined with Zod schemas for input validation. Tools are organized into 11 categories.
Note
File System 13 tools
| Tool | Description | Mutates |
|---|---|---|
| read_file | Read a text file from the workspace | No |
| read_multiple_files | Read multiple files in a single call | No |
| create_file | Stage creation of a new file | Yes |
| modify_file | Stage a full-file replacement | Yes |
| delete_file | Stage deletion of a file | Yes |
| create_folder | Stage creation of a directory tree (mkdir -p) | Yes |
| list_files | List files and directories under a path | No |
| search_files | Find files matching a glob pattern (e.g. *.ts) | No |
| analyze_codebase | Summarize project structure: file counts, size, extensions | No |
| grep | Search file contents using a text query | No |
| replace_in_file | Replace text inside a file while preserving the rest | Yes |
| append_to_file | Append content to the end of a file | Yes |
| insert_at_line | Insert content at a specific line number | Yes |
Shell & Execution 7 tools
| Tool | Description | Mutates |
|---|---|---|
| run_command | Run a command synchronously and capture output | No |
| run_background_command | Start a long-running detached process | No |
| execute_shell | Queue a shell command for post-approval execution | Yes |
| run_tests | Auto-detect and run the project test suite | No |
| run_test_file | Run a specific test file | No |
| lint_project | Auto-detect and run linting | No |
| format_project | Auto-detect and run formatting | No |
Git 3 tools
| Tool | Description |
|---|---|
| git_status | Get git status --short |
| git_diff | Get git diff (optionally staged) |
| git_log | Get recent commits (--oneline) |
Project Intelligence 2 tools
| Tool | Description |
|---|---|
| detect_framework | Detect framework from package.json |
| read_package_json | Read and summarize package.json |
Web 3 tools
| Tool | Description | Requires |
|---|---|---|
| web_search | Search the web, returns title/url/snippet list | Firecrawl key (or DuckDuckGo fallback) |
| web_crawl | Scrape a URL into markdown text | Firecrawl key |
| fetch_url | HTTP GET for a URL, returns response body | -- |
Planning 2 tools
| Tool | Description |
|---|---|
| create_plan | Create a task execution plan object in memory |
| get_plan | Retrieve the current plan as JSON |
Staging 2 tools
| Tool | Description |
|---|---|
| show_pending_changes | Display all staged operations (read-only) |
| discard_changes | Discard all staged operations from the overlay |
Skills 2 tools
| Tool | Description |
|---|---|
| list_skills | List SKILL.md files from configured skill directories |
| read_skill | Read a specific SKILL.md file |
Session 3 tools
| Tool | Description |
|---|---|
| session_status | Check recent session history (limit 1-20, default 5) |
| session_search | Search previous sessions by keyword, file name, or goal |
| session_resume_context | Get full context of a previous session for resumption |
Browser Automation (Playwright) 23 tools
Managed by a singleton Chromium browser instance via BrowserService, enabling programmatic automation and visual testing capability.
| Tool Name | Capability Description |
|---|---|
| browser_navigate | Navigates the current browser tab to any specified HTTP/HTTPS or local file URL. |
| browser_click | Clicks on an element matching a CSS, text, XPath, or ARIA selector. |
| browser_type | Enters and fills text fields or forms dynamically within the page. |
| browser_take_screenshot | Captures a PNG/JPEG screenshot of the current page viewport or a specific element. |
| browser_snapshot | Extracts comprehensive structural text, page HTML, title, and current URL. |
| browser_get_text | Retrieves text content from inside a target DOM selector element. |
| browser_new_tab / browser_switch_tab | Manages multi-tab navigation lifecycles synchronously. |
| browser_list_tabs / browser_set_viewport | Inspects active tabs or adjusts structural resolution properties. |
| browser_evaluate | Executes custom JavaScript directly inside the browser window context. |
Model Context Protocol (MCP) 4 tools
Allows standard stdio-based external MCP servers to register custom tools dynamically within the active agent environment, reading from config files.
| Tool Name | Capability Description |
|---|---|
| list_mcp_servers | Lists all active stdio servers, reporting runtime status and metrics. |
| add_mcp_server | Registers and boots a new stdio-based MCP server server definition. |
| remove_mcp_server | Gracefully disconnects and removes a configured server reference. |
| invoke_mcp_tool | Forwards tool calls with parameters directly to the connected MCP engine. |
Staging & Approval Pipeline
No mutation ever touches disk without explicit user consent. Astra uses a three-phase pipeline to ensure complete safety.
Phase 1: Staging
- Path safety validation -- must be within workspace root
- Exclude pattern check -- node_modules, .git, dist, build, .next, *.log, .env* are blocked
- File size check -- max 1 MB for reads
- Stage in memory overlay -- Map<string, string> + Set<string>
- Log to ActionTracker -- append-only audit trail with status: "pending"
Phase 2: Approval Flow
- "Approve and apply all" -- marks all pending actions as "approved"
- "Review one by one" -- groups by file path, iterates with accept / reject / diff options
- "Cancel" -- marks all as "rejected"
Diffs use unified format with 3 lines of context. Large diffs are truncated (120-line limit). Multiple actions on the same path are composed into a single before/after diff.
Phase 3: Application
- Folder creation first (sorted by timestamp)
- File operations sorted by timestamp, grouped by path -- only the last action per path is applied
- Shell commands executed via spawnSync with 16 MB buffer and 5-minute timeout
- appliedActionIds set prevents double-application
- Successfully applied actions are recorded to the persistent ActionHistoryManager in real-time
Staging Overlay Internals
private overlay = new Map<string, string>() // staged file contents
private deleted = new Set<string>() // staged deletions
private appliedActionIds = new Set<string>() // already-applied action IDs- createFile() -- removes from deleted, adds to overlay
- modifyFile() -- adds to overlay (reads "before" from overlay or disk)
- deleteFile() -- removes from overlay, adds to deleted
- getEffectiveText() -- checks deleted then overlay then disk
- discardStagedPath() -- removes from both overlay and deleted
Action Tracking System
An append-only log of every action the agent takes. Stored in ActionTracker and persisted to the session store.
Action Types
| Type | Description |
|---|---|
| file_create | A new file was staged |
| file_modify | An existing file was staged for replacement |
| file_delete | A file was staged for deletion |
| folder_create | A directory tree was staged for creation |
| code_analysis | A read-only analysis was performed (marked 'executed' immediately) |
| tool_execute | A shell command or web tool was invoked |
Action Status
| Status | Meaning |
|---|---|
| pending | Staged but not yet approved or rejected |
| executed | Read-only action completed immediately |
| approved | User approved the action for application |
| rejected | User rejected the action |
ActionLog Schema
interface ActionLog {
id: string // "action_0", "action_1", ...
timestamp: Date
type: ActionType
path: string // file path or "shell" or "skills" or "web"
details: {
before?: string; after?: string; toolName?: string
toolResult?: string; error?: string; command?: string
}
status: ActionStatus
userApproved?: boolean
}Tracker Methods
| Method | Description |
|---|---|
| log(entry) | Append a new action, auto-assigns ID and timestamp |
| getActions() | Returns the full readonly array of all actions |
| getPendingMutations() | Filters to mutation-type actions with status 'pending' |
| getPendingMutationsForPath(path) | Filters pending mutations to a specific path |
| updateStatus(id, status, userApproved?) | Updates an action's status |
Session Management
Sessions are persisted to disk with LLM-generated summaries. Astra supports auto-resume on interruption, workspace-level custom context configurations, and cross-session logs.
Workspace Level Guidelines (ASTRA.md)
Managed by the ProjectContextLoader inside session/project-context.ts. During initialization, it scans up the workspace directory hierarchy for an optional ASTRA.md file. If found, it parses code conventions, structure constraints, and styles, automatic injecting them into the primary system prompts of all downstream executing agents.
Storage
Sessions are stored in ~/.astra/sessions/index.json with atomic writes (temp file + rename).
interface SessionStoreIndex {
version: number // currently 2
sessions: SessionEntry[]
maxSessions: number // 100
}Session Entry Schema
interface SessionEntry {
id: string // "sess_m5k2x3_abc123"
workspacePath: string
mode: 'agent' | 'ask' | 'plan' | 'multi' | 'auto'
status: 'active' | 'completed' | 'interrupted'
summary: string // LLM-generated
lastGoal: string
allGoals: string[]
touchedFiles: string[]
appliedActions: number
rejectedActions: number
createdAt: string
updatedAt: string
previousSessionId?: string
transcript?: TranscriptMessage[] // capped at 60
pendingTasks?: string[]
lastAgentResponse?: string // truncated to 2000 chars
}Cache Layer
- Reads served from memory (no file I/O) when clean
- Writes batched with 500 ms debounce
- LRU entry cache (50 entries) for O(1) lookups by session ID
- flushSync() for critical shutdown paths
Session Lifecycle
- Begin -- creates entry with status: "active"; loads prior context if resuming
- Active -- agent performs work, actions accumulate
- End -- collects touched files, counts actions, generates LLM summary, sets status: "completed", syncs to action history
- Interrupt -- sets status: "interrupted", all state preserved
- Resume -- on wakeup, interrupted sessions offered for resumption
Resume Priority (3-tier)
- Explicit session ID (via session tools)
- Interrupted session in the same workspace
- Keyword overlap >= 30% between current goal and previous goals
Session Search (Relevance Scoring)
| Field | Weight |
|---|---|
| lastGoal | 50 |
| summary | 30 |
| tags | 25 |
| touchedFiles | 8 |
| recency bonus | variable |
Persistent Action History
All approved actions are logged to a persistent global JSONL file, queryable across distinct session branches.
ActionHistoryManager
- Log file: ~/.astra/history/actions.jsonl (JSON Lines, append-only format)
- Entry format: PersistentActionEntry containing globalActionId (UUID), sessionId, workspacePath, timestamp, and the full ActionLog record.
API Interface
| Method | Description |
|---|---|
| recordGlobalActions(sessionId, workspacePath, actions) | Appends approved/applied actions with unique UUID records using atomic writes. |
| getGlobalHistory(limit?) | Retrieves overall sequential history entries across all sessions (newest first, defaults to 500). |
| searchHistoryByFile(targetPath) | Finds all historical modifications and actions targeting a specific structural file path. |
Integration Points
- applyApprovedFromTracker() in tool-executor.ts -- records successfully applied actions in real-time.
- endSession() in session-manager.ts -- syncs all approved actions on standard session completion.
- endMultiSession() in session-manager.ts -- syncs aggregated multi-agent approved actions.
Multi-Agent Orchestration
Coordinates multiple AI agents working together in configurable topologies. The LLM analyzes your goal and either selects a pre-built template or designs a custom agent team.
Agent Roles
| Role | Permissions | Max Steps | Tools |
|---|---|---|---|
| researcher | Read-only | 30 | 16 |
| implementer | Full read/write/execute | 50 | 26 |
| reviewer | Read + execute (no writes) | 25 | 15 |
| coordinator | Read-only + planning | 20 | 8 |
| custom | Configurable | 30 | Variable |
Orchestration Strategies
| Strategy | Behavior | Failure Mode |
|---|---|---|
| Sequential | Agents run one after another; each sees previous outputs | fail-fast |
| Parallel | Agents run in batches of maxConcurrentAgents (default 3) via Promise.all() | continue |
| Hierarchical | Coordinator runs first, then specialists with coordinator's plan | fail-fast |
| Collaborative | Round-robin turns; output broadcast via MessageBroker | continue |
| DAG | Agents run when dependencies are satisfied; cycle detection and deadlock handling | fail-at-end |
Workflow Templates
| Template | Agents | Strategy |
|---|---|---|
| Code Review | Researcher -> Implementer -> Reviewer | Sequential (retry x1) |
| Feature Development | Coordinator -> Backend + Frontend -> QA | DAG |
| Bug Fixing | Debug -> Fix -> Test | Sequential (retry x2) |
| Collaborative Research | Researcher 1 + 2 + 3 | Parallel (3 concurrent, 45s timeout) |
| Security Audit | Scanner -> Static + Dependency Auditor -> Report | DAG |
| Full-Stack Feature | Architect -> DB + API + UI Dev -> Integration Tester | DAG |
Message Broker
| Method | Description |
|---|---|
| broadcast(msg) | Send to specific agent or all |
| subscribe(agentId, callback) | Register callback; returns unsubscribe function |
| getMessagesFor(agentId) | Filter messages (direct or broadcast) |
| replayMessages(agentId, callback) | Async iteration over message history |
Validation Checks (10+)
- Workflow ID and goal present; at least one agent, no duplicate IDs, no empty names
- maxSteps > 0, at least 1 tool per agent; valid strategy type
- Hierarchical requires a coordinator; collaborative with >1 agent needs a timeout
- Fallback agent IDs exist; dependency references valid, no self-references
- DAG cycle detection; warning if DAG strategy used without dependencies
Fluent Workflow Builder API
new WorkflowBuilder(id, goal)
.addResearcher(...)
.addImplementer(...)
.addReviewer(...)
.withDagStrategy(maxConcurrent, timeout)
.withRetryOnFailure(maxRetries)
.build()Sandbox Mode & Security
A secure, self-contained execution environment activated via astra sandbox.
Security Principles
- No secrets in config files -- API keys never touch ~/.astra/.env
- OS keychain storage -- macOS Keychain, Windows Credential Vault, Linux Secret Service (via keytar)
- AES-256-GCM file fallback -- encrypted file at ~/.astra/.secure/sandbox.enc (key from machine-id via scrypt, 0o600 perms, atomic writes)
- HMAC-SHA-256 signed requests -- with timestamps for replay protection
- Fixed model -- openrouter/owl-alpha (isolated from user config)
- Remote server -- https://astra-server-oh6s.onrender.com
- 5-minute in-memory key TTL with validation (sk-or-v1-* format)
Activation Flow
- Health check the sandbox server (GET /health)
- Generate secure random 32-byte hex auth token
- Bootstrap with server (POST /bootstrap with authToken)
- Validate and sanitize returned API key
- Store 3 credentials: sandbox-api-key, sandbox-auth-token, sandbox-signing-secret
- Set ASTRA_SANDBOX_ENABLED=true
Subsequent AI Calls
- getSandboxApiKey() checks keychain
- Check in-memory cache (5-min TTL)
- Fetch from server (GET /api/key, HMAC-signed)
- Validate, cache, and store; use key for OpenRouter API calls with owl-alpha model
Skills System
Skills are SKILL.md files providing structured guidance to the AI agent. Discoverable by agents via list_skills and read_skill tools.
Skill Directories (in order)
- Built-in: .skills/ (shipped with the package)
- Cursor: ~/.cursor/skills-cursor/
- Claude: ~/.claude/skills/
- Custom: SKILLS_DIRS env var (semicolon-separated paths)
Built-in Skills
| Skill | Purpose |
|---|---|
| code-review | Code review checklist (quality, error handling, security, performance, testing) |
| documentation | Documentation standards for README, CHANGELOG, and TSDoc comments |
| git-workflow | Branch naming conventions, conventional commits, pre-commit checklist |
| project-setup | Development environment setup guide |
| test-runner | Test execution patterns and result interpretation |
Skill File Format
---
name: skill-name
description: When to use this skill
---
# Skill Title
Instructions for the agent...Retry Engine
Configurable retry logic for AI provider calls and multi-agent step failures, with exponential backoff and jitter.
Error Categories
| Category | HTTP / Code | Retryable | Suggested Delay |
|---|---|---|---|
| TRANSIENT | 500, 502, 504 | Yes | 1s |
| RATE_LIMIT | 429 | Yes | 5s |
| NETWORK | ECONNRESET, ENOTFOUND | Yes | 2s |
| TIMEOUT | ETIMEDOUT | Yes | 3s |
| UNKNOWN | unclassified | Yes | 1s |
| PERMANENT | 4xx (except 429) | No | 0 |
| AUTH | 401, 403 | No | 0 |
Retry Presets
| Preset | Retries | Base Delay | Max Delay | Backoff | Jitter |
|---|---|---|---|---|---|
| aiCall | 3 | 1s | 30s | 2x | 1s |
| toolExecution | 2 | 500ms | 5s | 2x | 0 |
| network | 5 | 2s | 60s | 2x | 2s |
| critical | 5 | 1s | 60s | 2x | 1.5s |
Features
- Exponential backoff with configurable multiplier
- Random jitter to prevent thundering herd
- Per-attempt timeouts; onRetry and onExhausted callbacks
- withRetryOrNull() for non-throwing variants
- createRetryWrapper() for reusable retry-wrapped functions
Configuration
Astra is configured entirely through environment variables, loaded from ~/.astra/.env. Run astra setup for the interactive wizard.
Required Variables
| Variable | Description | Example |
|---|---|---|
| OPENROUTER_API_KEY | OpenRouter API key for LLM access | sk-or-v1-abc123... |
| OPENROUTER_DEFAULT_MODEL | Default model identifier | anthropic/claude-3.5-sonnet |
Optional Variables
| Variable | Description | Example |
|---|---|---|
| FIRECRAWL_API_KEY | Enables web_search, web_crawl, fetch_url via Firecrawl | fc-abc123... |
| SKILLS_DIRS | Semicolon-separated paths to custom skill directories | /path/to/skills;/another/dir |
Retry Configuration
| Variable | Default | Description |
|---|---|---|
| ASTRA_AGENT_RETRY_ENABLED | true | Enable automatic retry for agent AI calls |
| ASTRA_AGENT_RETRY_MAX | 3 | Maximum retry attempts for agent calls |
| ASTRA_AGENT_RETRY_PROGRESS | true | Show retry progress in the terminal |
| ASTRA_MULTI_RETRY_ENABLED | true | Enable retry for multi-agent steps |
| ASTRA_MULTI_RETRY_MAX | 2 | Maximum retry attempts for multi-agent steps |
| ASTRA_MULTI_RETRY_BACKOFF | 2 | Backoff multiplier for multi-agent retries |
Sandbox Variable
| Variable | Description |
|---|---|
| ASTRA_SANDBOX_ENABLED | Set to 'true' when sandbox mode is active. API key stored in OS keychain, not in ~/.astra/.env. |
File Locations
| Path | Purpose |
|---|---|
| ~/.astra/.env | Environment variables (API keys, model, settings) |
| ~/.astra/sessions/index.json | Session store (persisted conversation history) |
| ~/.astra/sessions/<session-id>.json | Individual session action logs |
| ~/.astra/.secure/sandbox.enc | Encrypted sandbox credentials (if OS keychain unavailable) |
| ~/.astra/logs/astra.log | Rotating error log file (5 MiB max, 3 backups) |
| ~/.astra/history/actions.jsonl | Persistent action history log (JSONL, all approved actions across sessions) |
TypeScript Configuration
| Option | Value |
|---|---|
| target | ESNext |
| module | Preserve (Bun-native resolution) |
| moduleResolution | bundler |
| strict | true |
| types | bun |
| noFallthroughCasesInSwitch | true |
| noUncheckedIndexedAccess | true |
| noImplicitOverride | true |
| noUnusedLocals | false |
| noUnusedParameters | false |
Project Structure
Every file in the Astra codebase and its purpose.
astrabot/
+-- index.ts # CLI entry point (Commander)
+-- package.json # Package config (astrabot v0.1.7)
+-- tsconfig.json # TypeScript config: ESNext, strict, Bun types
+-- bun.lock # Bun lockfile
+-- bin/astra # Binary entry point (#!/usr/bin/env bun)
+-- install/ # Cross-platform installer scripts
| +-- install.sh # Linux/macOS
| +-- install.bat # Windows
+-- ai/ # AI provider configuration
| +-- ai.config.ts # OpenRouter provider setup + model cache
| +-- config-loader.ts # ~/.astra/.env management
| +-- auto-retry.ts # AI call retry wrapper
| +-- sandbox-config.ts # Sandbox activation + HMAC signing
| +-- secure-storage.ts # Encrypted credential storage
+-- core/ # Core utilities
| +-- logger.ts # Centralised error logger (rotating file)
| +-- retry/ # Retry engine
| +-- retry-config.ts # ErrorCategory, RetryConfig, presets
| +-- retry-engine.ts # withRetry(), RetryPresets
| +-- error-classifier.ts # Error classification
+-- tui/ # Terminal UI
| +-- terminal-md.ts # Markdown-to-terminal rendering
| +-- spinner.ts # Animated spinner (metabolic rate engine)
| +-- wakeup.ts # ASCII banner + mode selection
+-- modes/ # Interaction modes
| +-- cli.ts # CLI mode loop
| +-- auto.ts # Auto mode (intent classifier)
| +-- setup.ts # Setup wizard
| +-- agent/ # Agent mode
| | +-- types.ts # ActionType, ActionLog, AgentConfig
| | +-- action-tracker.ts # Append-only action log
| | +-- agent-tools.ts # 35+ Vercel AI SDK tools
| | +-- browser-service.ts # Playwright browser manager
| | +-- browser-tools.ts # 23 Playwright-based browser tools
| | +-- tool-executor.ts # Staging overlay + implementations
| | +-- diff-view.ts # Unified diff generation
| | +-- approval.ts # Approval flow
| | +-- orchestrator.ts # Full agent lifecycle
| +-- ask/orchestrator.ts # Read-only Q&A
| +-- plan/ # Plan mode
| | +-- planner.ts # LLM-structured planning
| | +-- orchestrator.ts # Plan -> select -> execute -> approve
| +-- mcp/ # Model Context Protocol
| +-- manager.ts # MCP client and server proxy manager
| +-- multi/ # Multi-agent mode
| +-- multi-agent-orchestrator.ts # Strategy dispatch
| +-- workflow-builder.ts # Fluent API + templates
| +-- orchestrator.ts # AI workflow designer + execution
+-- session/ # Session management
| +-- store.ts # JSON file store (atomic writes)
| +-- session-manager.ts # Lifecycle & auto-resume
| +-- session-cache.ts # In-memory cache (debounced writes)
| +-- action-history.ts # Persistent cross-session action log
| +-- project-context.ts # Workspace ASTRA.md context loader
+-- .skills/ # Built-in skills (5 SKILL.md files)
+-- game/ # Arcade (6 HTML5 Canvas games)
+-- tests/cli.test.ts # CLI smoke tests
+-- .github/workflows/ci.yml # Bun install + testDependencies
Runtime
| Package | Version | Purpose |
|---|---|---|
| @openrouter/ai-sdk-provider | ^2.9.0 | OpenRouter LLM provider |
| @clack/prompts | ^1.4.0 | Interactive terminal prompts |
| @clack/core | ^1.3.1 | Core prompt primitives |
| @mendable/firecrawl-js | ^4.25.1 | Firecrawl SDK for web search/crawl |
| commander | ^15.0.0 | CLI argument parsing |
| chalk | ^5.6.2 | Terminal string styling |
| figlet | ^1.11.0 | ASCII art banner |
| marked | ^18.0.4 | Markdown parser |
| marked-terminal | ^7.3.0 | Markdown terminal renderer |
| diff | ^9.0.0 | Unified diff generation |
| dotenv | ^17.4.2 | .env file loading |
| docx | ^9.7.1 | Word document generation |
Dev
| Package | Version | Purpose |
|---|---|---|
| @types/bun | latest | Bun type definitions |
Peer
| Package | Version | Purpose |
|---|---|---|
| typescript | ^5 | TypeScript compiler |
Optional
| Package | Purpose |
|---|---|
| keytar | OS keychain access for sandbox credentials |
Changelog
All notable changes to Astra. Format based on keepachangelog.com, adhering to semver.org.
v0.1.7 2026-07-13
Added
- Browser Automation via Playwright -- Integrated Playwright browser-automation capabilities with a suite of 23 cross-platform layout, screenshot, click, and evaluate tools.
- Model Context Protocol (MCP) Integration -- Added support for loading stdio-based MCP servers and exposing tools dynamically to the agent workspace.
- Persistent Workspace-Level Context -- Added automatic system-prompt parsing of root-level
ASTRA.mddesign rule files. - Persistent action history -- New ActionHistoryManager logs all approved/applied actions to ~/.astra/history/actions.jsonl with UUIDs, session IDs, and timestamps.
- Cross-session action queries -- getGlobalHistory() and searchHistoryByFile() for querying modifications across sessions.
- Automatic history sync -- automatically maps and records transactions to the global history overlay on session end and application.
- Expanded Arcade Suite -- Integrated Neon Rush arcade game into the suite.
Changed
- CLI Wakeup Screen and Interface Upgrades -- Redesigned welcome greetings, setup routing workflows, and banner graphics layout.
v0.1.6 2026-07-04
Added
- Streaming output for Agent, Ask, and Plan modes via agent.stream().
- OpenRouter prompt caching with X-OpenRouter-Cache header and sticky session routing.
- Session-aware model cache with sessionId in cache key.
- Neon Memory & Neon Tetris arcade games.
v0.1.5 2026-07-03
Changed
- Sandbox server migrated to remote -- URL changed to https://astra-server-oh6s.onrender.com.
v0.1.4 2026-07-02
Removed
- Bundled server -- The server/ directory was removed.
v0.1.3 2026-07-01
Added
- Sandbox mode -- astra sandbox with OS keychain, AES-256-GCM fallback, HMAC signing.
- Session store cache -- 500ms debounced writes, LRU cache.
- Cross-platform installers -- install.sh and install.bat.
- Skills system -- 5 built-in skills as SKILL.md files.
v0.1.2 2026-06-08
Added
- Streaming agent output -- All modes migrated to agent.stream().
- Token telemetry -- Live counters with velocity summary (tok/s).
- Detailed step logging -- Per-step duration and token counts.
- Neon Pong arcade game.
v0.1.1 2026-06-07
Added
- Dynamic version in banner from package.json.
- npm binary entry point -- bin/astra shebang file.
- CI pipeline -- GitHub Actions workflow.
- CLI smoke tests for --version, --help, and command listing.
Changed
- Package rename from astra to astrabot (npm availability).
- Build simplification -- Removed tsc compile step; Bun executes TypeScript directly.
v0.1.0 2026-06-06
Added
- Five interaction modes -- Auto, Agent, Ask, Plan, Multi-Agent.
- 38 agent tools -- filesystem, shell, git, web, project intelligence, staging, skills, session.
- Staging & approval pipeline -- in-memory overlay with per-file diff review.
- Session management -- persistent sessions with auto-resume and cache.
- Multi-agent orchestration -- 5 strategies, 5 roles, 6 templates, fluent builder.
- Retry system -- 7 error categories, 4 presets, exponential backoff.
- Sandbox mode foundation -- OS keychain credential storage.
- Arcade -- Retro Snake and Neon Brick Breaker with local HTTP server.
- astra play and astra reset commands.
- Breathing banner animation with twinkling star field.
- Animated spinner with metabolic rate engine.
- Setup wizard for interactive configuration.
- Centralised error logger with rotating file output.
Roadmap
Planned and in-progress features for future Astra releases.
Implemented
- Streaming token output with real-time telemetry
- Direct prompt argument (astra "goal")
- Sandbox mode with secure credential storage
- Session store cache with debounced writes
- Cross-platform installers
- Skills system (5 built-in skills)
- Centralised error logger with rotating file output
- Sandbox remote server migration
- Persistent action history (cross-session JSONL log)
- Playwright browser automation
- Model Context Protocol (MCP) integration
- Workspace context via ASTRA.md
Planned
P0 -- Critical
- Undo/redo support via action log replay
- Multi-provider support
- Context window management
P1 -- Major
- Per-mode model selection
- Project-level config (.astrarcc)
- Diff-based editing
P2 -- Quality of Life
- astra watch (file watching mode)
- Pipe/stdin support
- Cost tracking
- Plugin system
P3 -- Future
- REPL mode
- Multimodal input
- LSP integration