amp-api-awareness

Extract hidden Amp API patterns from local thread data via DuckDB analysis

Safety Notice

This listing is imported from skills.sh public index metadata. Review upstream SKILL.md and repository scripts before running.

Copy this and send it to your AI assistant to learn

Install skill "amp-api-awareness" with this command: npx skills add plurigrid/asi/plurigrid-asi-amp-api-awareness

Amp API Awareness

Discover Amp's undocumented API by mining local thread storage.

Data Sources

SourcePathFormat
Threads~/.local/share/amp/threads/*.jsonJSON per thread
History~/.claude/history.jsonlJSONL sessions
Projects~/.claude/projects/*/*.jsonlJSONL per project

Quick Extraction

Count all threads

ls ~/.local/share/amp/threads/*.json | wc -l

Sample thread structure

cat ~/.local/share/amp/threads/T-*.json | head -1 | jq 'keys'
# Expected: ["id", "title", "created", "updatedAt", "messages", ...]

DuckDB unified query

-- Load all threads
CREATE TABLE amp_threads AS
SELECT * FROM read_json('~/.local/share/amp/threads/*.json', 
  columns={id: 'VARCHAR', title: 'VARCHAR', created: 'BIGINT', 
           messages: 'JSON[]', creatorUserID: 'VARCHAR'},
  ignore_errors=true);

-- Extract message patterns
SELECT 
  id,
  title,
  len(messages) as msg_count,
  abs(hash(id)) % 3 - 1 as trit
FROM amp_threads
ORDER BY created DESC
LIMIT 20;

API Discovery Patterns

1. Tool Usage Extraction

-- Find all tool invocations across threads
SELECT 
  json_extract_string(msg, '$.type') as msg_type,
  json_extract_string(msg, '$.name') as tool_name,
  count(*) as usage_count
FROM amp_threads, unnest(messages) as t(msg)
WHERE json_extract_string(msg, '$.type') = 'tool_use'
GROUP BY 1, 2
ORDER BY usage_count DESC;

2. MCP Server Detection

-- Extract MCP patterns from content
SELECT DISTINCT
  regexp_extract(content, 'mcp__([a-z_]+)__', 1) as mcp_server
FROM (
  SELECT json_extract_string(msg, '$.content') as content
  FROM amp_threads, unnest(messages) as t(msg)
)
WHERE mcp_server IS NOT NULL;

3. Thread Schema Discovery

// TypeScript extraction from thread JSON
interface AmpThread {
  id: string;           // T-{uuid}
  title: string;
  created: number;      // Unix timestamp ms
  updatedAt: string;    // ISO8601
  creatorUserID: string;
  messages: AmpMessage[];
}

interface AmpMessage {
  role: 'user' | 'assistant';
  content: ContentBlock[];
}

type ContentBlock = 
  | { type: 'text'; text: string }
  | { type: 'thinking'; thinking: string }
  | { type: 'tool_use'; id: string; name: string; input: unknown }
  | { type: 'tool_result'; tool_use_id: string; content: string };

Full Statistics (2,424 threads, 118,951 messages)

Core Tools

ToolInvocationsPurpose
Bash30,786Shell commands
Read10,373File reading
edit_file6,884File modification
create_file5,373File creation
todo_write3,862Task management
Grep2,837Pattern search
skill1,798Skill loading
Task1,314Sub-agent dispatch
glob1,121File patterns
mermaid1,014Diagrams
find_thread892Thread search
read_thread834Thread content

MCP Servers

ServerInvocationsTop Function
firecrawl1,715firecrawl_scrape (1,039)
exa1,323web_search_exa (1,150)
gay1,284palette (206), next_color (151)
deepwiki405ask_question (241)
beeper253list_messages (89)
radare2135Binary analysis
huggingface130ML model access
tree_sitter~100AST queries

Agent Modes

  • smart: 2,398 threads (99%)
  • rush: 1 thread
  • nil: 25 threads

Known Endpoints & APIs

Endpoint/CommandAccessNotes
ampcode.com/threads/T-*Public URLThread viewer
ampcode.com/settingsAuth requiredAPI key, account management
find_thread toolAgent APIQuery by DSL, returns creatorUserID
read_thread toolAgent APIExtract thread content by goal

CLI Commands

CommandPurpose
amp threads listLists threads with ID, title, visibility, messages
amp threads share --visibility <v>Set: private, public, unlisted, workspace, group
amp threads share --supportShare with Amp support for debugging
amp login / amp logoutAuth management
amp skill list/add/removeSkill management
amp mcp list/add/removeMCP server configuration

Visibility Levels

LevelDescription
privateOnly creator can see
workspaceAll workspace members can see
groupSpecific group access
publicAnyone with link
unlistedAnyone with link (not indexed)

User ID Format

From find_thread API:

creatorUserID: "user_01JZZT0P50CFR9XKKW8SXQ7J74"
  • Prefix: user_
  • Body: 26-char ULID-like identifier (TypeID format)

Workspace Member Discovery

Query workspace threads to find all creatorUserID values:

# Via find_thread DSL (repo: filter scopes to workspace)
find_thread "repo:i after:30d"

Example: Two users discovered in workspace i:

User IDThreads (7d)
user_01JZZT0P50CFR9XKKW8SXQ7J746
user_01K5ESNNPKQ43J06VRC1TS5AX04

Local Storage

PathContents
~/.local/share/amp/secrets.jsonAPI key (apiKey@https://ampcode.com/)
~/.local/share/amp/session.jsonCurrent agentMode
~/.local/share/amp/threads/*.jsonThread JSON files
~/.config/amp/settings.jsonUser preferences, MCP configs

Environment Variables

VariablePurpose
AMP_API_KEYAccess token (overrides stored key)
AMP_URLService URL (default: https://ampcode.com/)
AMP_SETTINGS_FILECustom settings path

GF(3) Classification

Threads are colored by hash:

abs(hash(id)) % 3 - 1 as trit
-- -1 = MINUS (validation threads)
--  0 = ERGODIC (coordination)
-- +1 = PLUS (generation)

Usage

# Export to DuckDB
duckdb amp-threads.duckdb -c "
  CREATE TABLE threads AS 
  SELECT * FROM read_json('~/.local/share/amp/threads/*.json', 
    ignore_errors=true);
"

# Query patterns
duckdb amp-threads.duckdb -c "
  SELECT title, created FROM threads 
  ORDER BY created DESC LIMIT 10;
"

Underlying LLM Cost Estimates (Jan 2026)

Amp uses multiple LLMs. Pricing per 1M tokens (input/output):

Claude 4.5 Series (Anthropic)

ModelInputOutputCache WriteCache ReadContext
Opus 4.5$5.00$25.00$6.25$0.50200K
Sonnet 4.5$3.00$15.00$3.75$0.30200K/1M
Haiku 4.5$1.00$5.00$1.25$0.10200K

Sonnet 4.5 >200K context: $6/$22.50 per 1M tokens

Gemini 3 Series (Google)

ModelInputOutputContext
Gemini 3 Pro (≤200K)$2.00$12.001M
Gemini 3 Pro (>200K)$4.00$18.001M
Gemini 3 Flash$0.50$3.001M

Amp Mode → Model Mapping

ModePrimary ModelCost Profile
smartClaude Opus 4.5$5/$25 (flagship)
rushClaude Haiku 4.5$1/$5 (efficient)
largeExtended context+50-100% premium

Thread Usage Distribution (from 2,424 threads)

ModelOccurrencesEst. % Usage
claude-opus-4-5-202511012,31295.4%
gemini-3-pro-preview271.1%
claude-sonnet-4-2025051450.2%
claude-haiku-4-5-2025100110.04%

Cost Optimizations Available

StrategySavingsNotes
Prompt CachingUp to 90%For repeated system prompts
Batch API50%Async processing
Rush Mode~80%Haiku vs Opus
Token OptimizationVariableConcise prompts

Amp Pricing Pass-Through

Amp passes LLM costs directly with no markup for individuals/teams.

  • Free tier: $10/day grant (all modes including Opus 4.5)
  • Enterprise: +50% over individual/team rates

Example Cost Calculation

Typical thread (~50 messages, 100K tokens total):

Opus 4.5: ~$1.50/thread (50K in × $5 + 50K out × $25)
Haiku 4.5: ~$0.30/thread (80% savings)
Gemini 3 Pro: ~$0.70/thread (mid-tier)

Related Skills

  • duckdb-ies - IES analytics layer
  • amp-team-usage - Team/session tracking
  • unified-reafference - Cross-agent session DB

SDF Interleaving

This skill connects to Software Design for Flexibility (Hanson & Sussman, 2021):

Primary Chapter: 10. Adventure Game Example

Concepts: autonomous agent, game, synthesis

GF(3) Balanced Triad

amp-api-awareness (−) + SDF.Ch10 (+) + [balancer] (○) = 0

Skill Trit: -1 (MINUS - verification)

Secondary Chapters

  • Ch2: Domain-Specific Languages
  • Ch9: Generic Procedures
  • Ch8: Degeneracy
  • Ch4: Pattern Matching
  • Ch5: Evaluation
  • Ch6: Layering

Connection Pattern

Adventure games synthesize techniques. This skill integrates multiple patterns.

Source Transparency

This detail page is rendered from real SKILL.md content. Trust labels are metadata-based hints, not a safety guarantee.

Related Skills

Related by shared tags or category signals.

Research

academic-research

No summary provided by upstream source.

Repository SourceNeeds Review
Research

behaviour-surprisal-analysis

No summary provided by upstream source.

Repository SourceNeeds Review
Research

variant-analysis

No summary provided by upstream source.

Repository SourceNeeds Review