README
ΒΆ
SpaceMolt View Learning
Interactive CLI tool for querying and viewing agent learning records, experience history, and discovered systems from the knowledge base.
Overview
view-learning provides command-line access to the SpaceMolt knowledge base, allowing you to query agent learning data, experience histories, skill progression, and discovered systems. It supports both table and JSON output formats with beautiful terminal styling.
Features
Core Functionality
- π Agent Listing - List all registered agents with summaries
- π Experience History - View action history and experiences
- πΊοΈ System Discovery - Show discovered systems with connections
- π Statistics - Display learning statistics and summaries
- π¨ Beautiful Output - Styled terminal output with colors and formatting
Commands
- agents - List all registered agents
- history - Show action history for an agent
- experiences - Show experience records for an agent
- systems - Show all discovered systems
- summary - Show learning statistics for an agent
Quick Start
Basic Usage
# List all agents
go run ./cmd/view-learning agents
# Show agent history
go run ./cmd/view-learning history explorer-7
# Show discovered systems
go run ./cmd/view-learning systems
# Show agent summary
go run ./cmd/view-learning summary explorer-7
Building
# Build the binary
go build -o bin/view-learning ./cmd/view-learning
# Run the built binary
./bin/view-learning agents
Command-Line Flags
Global Flags
-db-path string
Path to SQLite database file (default "spacemolt-knowledge.db")
-limit int
Limit number of records to show (default 20)
-format string
Output format: table, json (default "table")
-sort string
Sort order: time, type (default "time")
Commands
agents
List all registered agents in the knowledge base.
Usage:
view-learning agents [flags]
Example:
go run ./cmd/view-learning agents
Output:
Registered Agents
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Explorer 7 [explorer-7]
Role: explorer
Faction: voidborn
Experiences: 145
Systems Visited: 23
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Miner 1 [miner-1]
Role: miner
Experiences: 89
Systems Visited: 5
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Total: 2 agent(s)
history
Show action history for an agent.
Usage:
view-learning history <agent-id> [flags]
Example:
go run ./cmd/view-learning history explorer-7
Output:
Action History for Agent: explorer-7
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
[2026-02-23 10:15:30] [mining] Mined iron_ore at asteroid_belt_1
Outcome: +25.0 iron_ore
Location: sol-2/asteroid_belt_1
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
[2026-02-23 10:14:15] [travel] Traveled from sol to sol-2
Outcome: Arrived at sol-2
Location: sol-2
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Total: 2 record(s)
experiences
Show experience records for an agent.
Usage:
view-learning experiences <agent-id> [flags]
Example:
go run ./cmd/view-learning experiences explorer-7 --limit 50
Output:
Experiences for Agent: explorer-7
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Time Type Description
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
2 min ago mining Mined iron_ore at asteroid_belt_1
β +25.0 iron_ore
β @ sol-2/asteroid_belt_1
5 min ago travel Traveled from sol to sol-2
β Arrived at sol-2
β @ sol-2
1 hr ago discovery Discovered new system
β Found sol-3
β @ sol-3
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Total: 3 experience(s)
systems
Show all discovered systems.
Usage:
view-learning systems [flags]
Example:
go run ./cmd/view-learning systems --limit 50
Output:
Discovered Systems
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Sol [sol]
Position: (0.0, 0.0, 0.0)
Police: 5
Faction: voidborn
Visits: 45
Last Visited: 2 min ago
Discovered By: explorer-7
Connections: 3 system(s)
sol-2, sol-3, corsair
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Sol-2 [sol-2]
Position: (15.0, 5.0, -2.0)
Police: 3
Faction: voidborn
Visits: 23
Last Visited: 5 min ago
Discovered By: explorer-7
Connections: 2 system(s)
sol, sol-3
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Total: 2 system(s)
summary
Show learning statistics for an agent.
Usage:
view-learning summary <agent-id> [flags]
Example:
go run ./cmd/view-learning summary explorer-7
Output:
Agent Summary: Explorer 7
ID: explorer-7
Agent Information
ββββββββββββββββββββββββββββββββββββββββ
Role: explorer
Faction: voidborn
Learning Statistics
ββββββββββββββββββββββββββββββββββββββββ
Total Experiences: 145
Unique Locations: 23
Last Activity: 2 min ago
Experiences by Type
ββββββββββββββββββββββββββββββββββββββββ
mining: ββββββββββββ 45
travel: ββββββββ 32
discovery: βββββ 18
trading: ββββ 12
combat: ββ 8
Recent Activity
ββββββββββββββββββββββββββββββββββββββββ
[2 min ago] Mined iron_ore at asteroid_belt_1
β +25.0 iron_ore
[5 min ago] Traveled from sol to sol-2
β Arrived at sol-2
[1 hr ago] Discovered new system
β Found sol-3
Output Formats
Table Format (Default)
Human-readable with colors and formatting:
go run ./cmd/view-learning agents
JSON Format
Machine-readable for automation:
go run ./cmd/view-learning agents --format json
Output:
[
{
"id": "explorer-7",
"name": "Explorer 7",
"role": "explorer",
"faction": "voidborn",
"status": "active"
},
{
"id": "miner-1",
"name": "Miner 1",
"role": "miner",
"faction": null,
"status": "active"
}
]
Examples
Example 1: Quick Agent Overview
# List all agents
go run ./cmd/view-learning agents
# Get specific agent summary
go run ./cmd/view-learning summary explorer-7
Example 2: Analyze Learning Progress
# Show recent experiences
go run ./cmd/view-learning experiences explorer-7 --limit 50
# Sort by type
go run ./cmd/view-learning experiences explorer-7 --sort type
Example 3: System Discovery Tracking
# Show all discovered systems
go run ./cmd/view-learning systems
# Show with JSON output
go run ./cmd/view-learning systems --format json > systems.json
Example 4: Custom Database
# Use custom database path
go run ./cmd/view-learning -db-path /path/to/knowledge.db agents
Example 5: Data Export
# Export agent history
go run ./cmd/view-learning history explorer-7 --format json > explorer-7-history.json
# Export all agents
go run ./cmd/view-learning agents --format json > agents.json
Database Schema
The tool queries these tables:
agents
CREATE TABLE agents (
id TEXT PRIMARY KEY,
name TEXT NOT NULL,
role TEXT NOT NULL,
faction TEXT,
status TEXT NOT NULL
);
experiences
CREATE TABLE experiences (
id INTEGER PRIMARY KEY AUTOINCREMENT,
agent_id TEXT NOT NULL,
time TEXT NOT NULL,
type TEXT NOT NULL,
description TEXT NOT NULL,
outcome TEXT,
location TEXT,
FOREIGN KEY (agent_id) REFERENCES agents(id)
);
systems
CREATE TABLE systems (
id TEXT PRIMARY KEY,
name TEXT NOT NULL,
pos_x REAL,
pos_y REAL,
pos_z REAL,
police_level INTEGER,
faction TEXT,
visit_count INTEGER,
last_visited TEXT,
discovered_by TEXT
);
connections
CREATE TABLE connections (
from_system TEXT NOT NULL,
to_system TEXT NOT NULL,
PRIMARY KEY (from_system, to_system),
FOREIGN KEY (from_system) REFERENCES systems(id),
FOREIGN KEY (to_system) REFERENCES systems(id)
);
Integration
With Scripts
#!/bin/bash
# Check agent activity
AGENT_ID="explorer-7"
# Get last activity
LAST=$(go run ./cmd/view-learning summary $AGENT_ID --format json | \
jq -r '.last_activity')
echo "Agent $AGENT_ID last active: $LAST"
# Get experience count
COUNT=$(go run ./cmd/view-learning summary $AGENT_ID --format json | \
jq -r '.total_experiences')
echo "Total experiences: $COUNT"
With Monitoring
#!/bin/bash
# Monitor agent learning
while true; do
echo "=== $(date) ==="
go run ./cmd/view-learning agents
sleep 300
done
Troubleshooting
Issue: "Failed to open database"
Cause: Database file not found or corrupted.
Solution:
- Verify database path:
-db-path spacemolt-knowledge.db - Check file exists:
ls spacemolt-knowledge.db - Check file permissions
Issue: "No agents registered"
Cause: Database is empty or no agents registered.
Solution:
- Run agents to populate database
- Check agent is registering properly
- Verify agent manager is running
Issue: "Agent not found"
Cause: Agent ID doesn't exist in database.
Solution:
- List all agents:
go run ./cmd/view-learning agents - Use correct agent ID
- Check agent spelling
Issue: "No experience records found"
Cause: Agent hasn't recorded experiences yet.
Solution:
- Verify agent is running
- Check agent is recording experiences
- Wait for agent to perform actions
Best Practices
Regular Monitoring
# Daily check of agent activity
go run ./cmd/view-learning agents
# Weekly detailed review
go run ./cmd/view-learning experiences explorer-7 --limit 100
Data Export
# Regular backups
go run ./cmd/view-learning agents --format json > backup/agents-$(date +%Y%m%d).json
go run ./cmd/view-learning systems --format json > backup/systems-$(date +%Y%m%d).json
Analysis
# Compare agents
for agent in explorer-7 miner-1 trader-1; do
echo "=== $agent ==="
go run ./cmd/view-learning summary $agent
done
Related Tools
- view-market - View market data
- test-agent - Test agent functionality
- Knowledge Base - Knowledge base implementation
License
Part of the SpaceMolt project.