Introduction
01

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

Astra runs on Bun, not Node.js. npm / npx are used only for package distribution. All TypeScript source is executed directly by Bun at runtime.

Interaction Modes at a Glance

ModePurposeFile Mutations
AutoLLM-powered intent router -- picks the best mode for your requestDepends on route
AgentAutonomous multi-step code modifications with browser controlYes (staged)
AskRead-only Q&A about your codebaseNo (except optional save)
PlanStructured multi-step planning with selective executionYes (staged)
Multi-AgentMultiple agents working in configurable topologiesYes (staged)
02

Quickstart

Get Astra up and running in under a minute.

Step 1: Install

bash
npm install -g astrabot

Step 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.

bash
astra setup

Step 3: Navigate to Your Project

bash
cd /path/to/your/project

Step 4: Use It

bash
# 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

You can also run Astra without installing: npx astrabot "your goal here"
03

Installation

Prerequisites

RequirementVersionPurpose
Bun>= 1.0.0JavaScript / 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.

bash
# Linux / macOS
bash install/install.sh

# Windows
install\install.bat

Option 2: Install Globally via npm

bash
npm install -g astrabot
astra --version
npm update -g astrabot
npm uninstall -g astrabot

Option 3: Run Directly with npx (No Installation)

bash
npx astrabot setup
npx astrabot wakeup
npx astrabot "explain how this works"

Option 4: Install from Source

bash
git clone https://github.com/OneDev-Harsh/astra-cli.git
cd astra-cli
bun install
bun run index.ts setup
04

Commands

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.

bash
astra "fix the bug in store.ts"
astra

The 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.

  1. OpenRouter API key input
  2. Model selection -- fetches available models from OpenRouter API with search and pricing display
  3. Optional Firecrawl API key
  4. Optional custom skills directories (semicolon-separated paths)

Tip

Re-run 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.

  1. Health check the sandbox server
  2. Generate a secure random 32-byte hex auth token
  3. Bootstrap with the server (POST /bootstrap)
  4. Validate and sanitize the returned API key
  5. Store credentials in OS keychain (or AES-256-GCM encrypted file fallback)
  6. 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.

GameFile
Retro Snake Classicindex.html
Neon Brick Breakerneon-breaker.html
Neon Pongneon-pong.html
Neon Memoryneon-memory.html
Neon Tetrisneon-tetris.html
Neon Rushneon-rush.html

astra reset destructive

Purges all stored configurations, sessions, and credentials from ~/.astra/. Requires explicit confirmation via interactive prompt.

Warning

This action is irreversible. All session history, API keys, and configuration will be permanently deleted.
05

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 PatternRouted 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.

  1. Goal input from user
  2. Initialize with defaultAgentConfig() (1 MB file size limit, exclude patterns, all tool permissions enabled)
  3. Begin session with workspace path, mode "agent", and goal; load ASTRA.md project conventions context automatically
  4. Construct ToolLoopAgent with stopWhen: stepCountIs(50)
  5. Execute via agent.stream() with per-step logging and token telemetry
  6. Auto-retry on error, with manual retry fallback
  7. Render final response as markdown in terminal
  8. Run approval flow for staged changes
  9. Apply approved changes to disk and record to persistent history log in real-time
  10. 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.

  1. Goal input from user
  2. Plan generation via Output.object() with Zod schema (researchSummary + steps[])
  3. Display plan -- numbered steps with color-coded complexity (low=green, medium=yellow, high=red)
  4. Step selection via @clack/prompts multiselect (all pre-selected)
  5. Each selected step runs as independent ToolLoopAgent (50 steps max)
  6. 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
06

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

Tools marked as "mutate" are staged in an in-memory overlay and require explicit user approval before being written to disk. Read-only tools execute immediately.

File System 13 tools

ToolDescriptionMutates
read_fileRead a text file from the workspaceNo
read_multiple_filesRead multiple files in a single callNo
create_fileStage creation of a new fileYes
modify_fileStage a full-file replacementYes
delete_fileStage deletion of a fileYes
create_folderStage creation of a directory tree (mkdir -p)Yes
list_filesList files and directories under a pathNo
search_filesFind files matching a glob pattern (e.g. *.ts)No
analyze_codebaseSummarize project structure: file counts, size, extensionsNo
grepSearch file contents using a text queryNo
replace_in_fileReplace text inside a file while preserving the restYes
append_to_fileAppend content to the end of a fileYes
insert_at_lineInsert content at a specific line numberYes

Shell & Execution 7 tools

ToolDescriptionMutates
run_commandRun a command synchronously and capture outputNo
run_background_commandStart a long-running detached processNo
execute_shellQueue a shell command for post-approval executionYes
run_testsAuto-detect and run the project test suiteNo
run_test_fileRun a specific test fileNo
lint_projectAuto-detect and run lintingNo
format_projectAuto-detect and run formattingNo

Git 3 tools

ToolDescription
git_statusGet git status --short
git_diffGet git diff (optionally staged)
git_logGet recent commits (--oneline)

Project Intelligence 2 tools

ToolDescription
detect_frameworkDetect framework from package.json
read_package_jsonRead and summarize package.json

Web 3 tools

ToolDescriptionRequires
web_searchSearch the web, returns title/url/snippet listFirecrawl key (or DuckDuckGo fallback)
web_crawlScrape a URL into markdown textFirecrawl key
fetch_urlHTTP GET for a URL, returns response body--

Planning 2 tools

ToolDescription
create_planCreate a task execution plan object in memory
get_planRetrieve the current plan as JSON

Staging 2 tools

ToolDescription
show_pending_changesDisplay all staged operations (read-only)
discard_changesDiscard all staged operations from the overlay

Skills 2 tools

ToolDescription
list_skillsList SKILL.md files from configured skill directories
read_skillRead a specific SKILL.md file

Session 3 tools

ToolDescription
session_statusCheck recent session history (limit 1-20, default 5)
session_searchSearch previous sessions by keyword, file name, or goal
session_resume_contextGet 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 NameCapability Description
browser_navigateNavigates the current browser tab to any specified HTTP/HTTPS or local file URL.
browser_clickClicks on an element matching a CSS, text, XPath, or ARIA selector.
browser_typeEnters and fills text fields or forms dynamically within the page.
browser_take_screenshotCaptures a PNG/JPEG screenshot of the current page viewport or a specific element.
browser_snapshotExtracts comprehensive structural text, page HTML, title, and current URL.
browser_get_textRetrieves text content from inside a target DOM selector element.
browser_new_tab / browser_switch_tabManages multi-tab navigation lifecycles synchronously.
browser_list_tabs / browser_set_viewportInspects active tabs or adjusts structural resolution properties.
browser_evaluateExecutes 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 NameCapability Description
list_mcp_serversLists all active stdio servers, reporting runtime status and metrics.
add_mcp_serverRegisters and boots a new stdio-based MCP server server definition.
remove_mcp_serverGracefully disconnects and removes a configured server reference.
invoke_mcp_toolForwards tool calls with parameters directly to the connected MCP engine.
07

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

  1. Path safety validation -- must be within workspace root
  2. Exclude pattern check -- node_modules, .git, dist, build, .next, *.log, .env* are blocked
  3. File size check -- max 1 MB for reads
  4. Stage in memory overlay -- Map<string, string> + Set<string>
  5. 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

  1. Folder creation first (sorted by timestamp)
  2. File operations sorted by timestamp, grouped by path -- only the last action per path is applied
  3. Shell commands executed via spawnSync with 16 MB buffer and 5-minute timeout
  4. appliedActionIds set prevents double-application
  5. Successfully applied actions are recorded to the persistent ActionHistoryManager in real-time

Staging Overlay Internals

typescript
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
08

Action Tracking System

An append-only log of every action the agent takes. Stored in ActionTracker and persisted to the session store.

Action Types

TypeDescription
file_createA new file was staged
file_modifyAn existing file was staged for replacement
file_deleteA file was staged for deletion
folder_createA directory tree was staged for creation
code_analysisA read-only analysis was performed (marked 'executed' immediately)
tool_executeA shell command or web tool was invoked

Action Status

StatusMeaning
pendingStaged but not yet approved or rejected
executedRead-only action completed immediately
approvedUser approved the action for application
rejectedUser rejected the action

ActionLog Schema

typescript
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

MethodDescription
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
09

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).

typescript
interface SessionStoreIndex {
  version: number          // currently 2
  sessions: SessionEntry[]
  maxSessions: number      // 100
}

Session Entry Schema

typescript
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

  1. Begin -- creates entry with status: "active"; loads prior context if resuming
  2. Active -- agent performs work, actions accumulate
  3. End -- collects touched files, counts actions, generates LLM summary, sets status: "completed", syncs to action history
  4. Interrupt -- sets status: "interrupted", all state preserved
  5. Resume -- on wakeup, interrupted sessions offered for resumption

Resume Priority (3-tier)

  1. Explicit session ID (via session tools)
  2. Interrupted session in the same workspace
  3. Keyword overlap >= 30% between current goal and previous goals

Session Search (Relevance Scoring)

FieldWeight
lastGoal50
summary30
tags25
touchedFiles8
recency bonusvariable
10

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

MethodDescription
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.
11

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

RolePermissionsMax StepsTools
researcherRead-only3016
implementerFull read/write/execute5026
reviewerRead + execute (no writes)2515
coordinatorRead-only + planning208
customConfigurable30Variable

Orchestration Strategies

StrategyBehaviorFailure Mode
SequentialAgents run one after another; each sees previous outputsfail-fast
ParallelAgents run in batches of maxConcurrentAgents (default 3) via Promise.all()continue
HierarchicalCoordinator runs first, then specialists with coordinator's planfail-fast
CollaborativeRound-robin turns; output broadcast via MessageBrokercontinue
DAGAgents run when dependencies are satisfied; cycle detection and deadlock handlingfail-at-end

Workflow Templates

TemplateAgentsStrategy
Code ReviewResearcher -> Implementer -> ReviewerSequential (retry x1)
Feature DevelopmentCoordinator -> Backend + Frontend -> QADAG
Bug FixingDebug -> Fix -> TestSequential (retry x2)
Collaborative ResearchResearcher 1 + 2 + 3Parallel (3 concurrent, 45s timeout)
Security AuditScanner -> Static + Dependency Auditor -> ReportDAG
Full-Stack FeatureArchitect -> DB + API + UI Dev -> Integration TesterDAG

Message Broker

MethodDescription
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

typescript
new WorkflowBuilder(id, goal)
  .addResearcher(...)
  .addImplementer(...)
  .addReviewer(...)
  .withDagStrategy(maxConcurrent, timeout)
  .withRetryOnFailure(maxRetries)
  .build()
12

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

  1. Health check the sandbox server (GET /health)
  2. Generate secure random 32-byte hex auth token
  3. Bootstrap with server (POST /bootstrap with authToken)
  4. Validate and sanitize returned API key
  5. Store 3 credentials: sandbox-api-key, sandbox-auth-token, sandbox-signing-secret
  6. Set ASTRA_SANDBOX_ENABLED=true

Subsequent AI Calls

  1. getSandboxApiKey() checks keychain
  2. Check in-memory cache (5-min TTL)
  3. Fetch from server (GET /api/key, HMAC-signed)
  4. Validate, cache, and store; use key for OpenRouter API calls with owl-alpha model
13

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)

  1. Built-in: .skills/ (shipped with the package)
  2. Cursor: ~/.cursor/skills-cursor/
  3. Claude: ~/.claude/skills/
  4. Custom: SKILLS_DIRS env var (semicolon-separated paths)

Built-in Skills

SkillPurpose
code-reviewCode review checklist (quality, error handling, security, performance, testing)
documentationDocumentation standards for README, CHANGELOG, and TSDoc comments
git-workflowBranch naming conventions, conventional commits, pre-commit checklist
project-setupDevelopment environment setup guide
test-runnerTest execution patterns and result interpretation

Skill File Format

markdown
---
name: skill-name
description: When to use this skill
---

# Skill Title

Instructions for the agent...
14

Retry Engine

Configurable retry logic for AI provider calls and multi-agent step failures, with exponential backoff and jitter.

Error Categories

CategoryHTTP / CodeRetryableSuggested Delay
TRANSIENT500, 502, 504Yes1s
RATE_LIMIT429Yes5s
NETWORKECONNRESET, ENOTFOUNDYes2s
TIMEOUTETIMEDOUTYes3s
UNKNOWNunclassifiedYes1s
PERMANENT4xx (except 429)No0
AUTH401, 403No0

Retry Presets

PresetRetriesBase DelayMax DelayBackoffJitter
aiCall31s30s2x1s
toolExecution2500ms5s2x0
network52s60s2x2s
critical51s60s2x1.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
15

Configuration

Astra is configured entirely through environment variables, loaded from ~/.astra/.env. Run astra setup for the interactive wizard.

Required Variables

VariableDescriptionExample
OPENROUTER_API_KEYOpenRouter API key for LLM accesssk-or-v1-abc123...
OPENROUTER_DEFAULT_MODELDefault model identifieranthropic/claude-3.5-sonnet

Optional Variables

VariableDescriptionExample
FIRECRAWL_API_KEYEnables web_search, web_crawl, fetch_url via Firecrawlfc-abc123...
SKILLS_DIRSSemicolon-separated paths to custom skill directories/path/to/skills;/another/dir

Retry Configuration

VariableDefaultDescription
ASTRA_AGENT_RETRY_ENABLEDtrueEnable automatic retry for agent AI calls
ASTRA_AGENT_RETRY_MAX3Maximum retry attempts for agent calls
ASTRA_AGENT_RETRY_PROGRESStrueShow retry progress in the terminal
ASTRA_MULTI_RETRY_ENABLEDtrueEnable retry for multi-agent steps
ASTRA_MULTI_RETRY_MAX2Maximum retry attempts for multi-agent steps
ASTRA_MULTI_RETRY_BACKOFF2Backoff multiplier for multi-agent retries

Sandbox Variable

VariableDescription
ASTRA_SANDBOX_ENABLEDSet to 'true' when sandbox mode is active. API key stored in OS keychain, not in ~/.astra/.env.

File Locations

PathPurpose
~/.astra/.envEnvironment variables (API keys, model, settings)
~/.astra/sessions/index.jsonSession store (persisted conversation history)
~/.astra/sessions/<session-id>.jsonIndividual session action logs
~/.astra/.secure/sandbox.encEncrypted sandbox credentials (if OS keychain unavailable)
~/.astra/logs/astra.logRotating error log file (5 MiB max, 3 backups)
~/.astra/history/actions.jsonlPersistent action history log (JSONL, all approved actions across sessions)

TypeScript Configuration

OptionValue
targetESNext
modulePreserve (Bun-native resolution)
moduleResolutionbundler
stricttrue
typesbun
noFallthroughCasesInSwitchtrue
noUncheckedIndexedAccesstrue
noImplicitOverridetrue
noUnusedLocalsfalse
noUnusedParametersfalse
16

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 + test
17

Dependencies

Runtime

PackageVersionPurpose
@openrouter/ai-sdk-provider^2.9.0OpenRouter LLM provider
@clack/prompts^1.4.0Interactive terminal prompts
@clack/core^1.3.1Core prompt primitives
@mendable/firecrawl-js^4.25.1Firecrawl SDK for web search/crawl
commander^15.0.0CLI argument parsing
chalk^5.6.2Terminal string styling
figlet^1.11.0ASCII art banner
marked^18.0.4Markdown parser
marked-terminal^7.3.0Markdown terminal renderer
diff^9.0.0Unified diff generation
dotenv^17.4.2.env file loading
docx^9.7.1Word document generation

Dev

PackageVersionPurpose
@types/bunlatestBun type definitions

Peer

PackageVersionPurpose
typescript^5TypeScript compiler

Optional

PackagePurpose
keytarOS keychain access for sandbox credentials
18

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.md design 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.
19

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