Internal CLI

Built-in CLI tool for testing, demonstration, and interactive conversations with AbstractCore. This is AbstractCore's internal testing CLI, not to be confused with external agentic CLIs.

🚀 Quick Start

Start the internal CLI with any provider:

# Start the internal CLI
python -m abstractcore.utils.cli --provider ollama --model qwen3-coder:30b

# Or with any provider
python -m abstractcore.utils.cli --provider openai --model gpt-4o-mini
python -m abstractcore.utils.cli --provider anthropic --model claude-3-5-haiku-latest

# With streaming enabled
python -m abstractcore.utils.cli --provider ollama --model qwen3-coder:30b --stream

💡 Note: Looking for external agentic CLI integration (Codex, Gemini CLI, Crush)? See the Server Documentation for complete setup guides.

⚡ Available Commands

/compact

Compress chat history while preserving context

/compact

/facts

Extract facts from conversation as structured data

/facts [file]

/judge

Evaluate conversation quality using LLM-as-a-judge

/judge

/stream

Toggle real-time streaming of responses

/stream

/history

Show conversation history without truncation

/history [n]

/system

Manage system prompt that guides AI behavior

/system [prompt]

📎 Media Handling

The internal CLI supports universal media handling with the @filename syntax for attaching images, documents, and data files.

@filename Syntax

Attach any file type using the @filename syntax in your prompt:

# Image analysis
python -m abstractcore.utils.cli --prompt "What's in this image? @photo.jpg"

# PDF document analysis
python -m abstractcore.utils.cli --prompt "Summarize @report.pdf"

# Office documents
python -m abstractcore.utils.cli --prompt "Extract key points from @presentation.pptx"
python -m abstractcore.utils.cli --prompt "Analyze the data in @spreadsheet.xlsx"

# Data files
python -m abstractcore.utils.cli --prompt "What patterns are in @sales_data.csv"

# Multiple files
python -m abstractcore.utils.cli --prompt "Compare @chart.png and @data.csv"

Supported File Types

  • Images: PNG, JPEG, GIF, WEBP, BMP, TIFF
  • Documents: PDF, DOCX, XLSX, PPTX
  • Data/Text: CSV, TSV, TXT, MD, JSON, XML

How It Works

The system automatically:

  1. Detects file type from extension
  2. Applies appropriate processor (Image, PDF, Office, Text)
  3. Formats content for the selected provider's API
  4. Handles vision fallback for text-only models when needed

📚 Command Details

🗜️ /compact - Chat History Compaction

Compacts your chat history using the fast local gemma3:1b model to create a summary while preserving recent exchanges.

# In the CLI
/compact

# Output example:
🗜️  Compacting chat history...
   Before: 15 messages (~450 tokens)
   Using gemma3:1b for compaction...
✅ Compaction completed in 3.2s
   After: 5 messages (~280 tokens)
   Structure:
   1. ⚙️  System prompt
   2. 📚 Conversation summary (1,200 chars)
   3. 👤 How do I handle errors in Python?
   4. 🤖 You can use try/except blocks...
   5. 👤 What about logging?

When to use:

  • Long conversations that slow down responses
  • When you want to preserve context but reduce memory usage
  • Before switching to a different topic

⚖️ /judge - Conversation Quality Evaluation

Evaluates the quality and interest of the current discussion using LLM-as-a-judge. This demonstrates objective assessment capabilities with constructive feedback.

# In the CLI
/judge

# Output example:
⚖️  Evaluating conversation quality...
   Analyzing 450 characters of conversation...
✅ Evaluation completed in 35.2s

📊 Overall Discussion Quality: 4/5

📈 Quality Dimensions:
   Clarity      : 5/5
   Coherence    : 4/5
   Actionability: 3/5
   Relevance    : 5/5
   Completeness : 4/5
   Soundness    : 4/5
   Simplicity   : 5/5

✅ Conversation Strengths:
   • The discussion maintains clear focus and addresses questions directly
   • Explanations are well-structured and easy to follow
   • Technical concepts are explained in accessible language

💡 Suggestions for Better Discussions:
   • Include more specific examples to illustrate key points
   • Add actionable next steps or recommendations where appropriate
   • Consider exploring alternative approaches or edge cases

When to use:

  • Get objective feedback on discussion quality
  • Understand strengths and areas for improvement
  • Demonstrate LLM-as-a-judge evaluation capabilities
  • Practice critical assessment and constructive feedback

🔍 /facts - Extract Structured Facts

Extracts facts from your conversation history as simple triples (subject-predicate-object). Display them in chat or save as structured JSON-LD.

# Display facts in chat
/facts

# Output example:
🔍 Extracting facts from conversation history...
   Processing 415 characters of conversation...
✅ Fact extraction completed in 4.5s

📋 Facts extracted from conversation:
==================================================
 1. OpenAI creates GPT-4
 2. Microsoft Copilot uses GPT-4
 3. Google develops TensorFlow
==================================================
📊 Found 3 entities and 2 relationships

# Save to JSON-LD file
/facts myconversation

# Output example:
🔍 Extracting facts from conversation history...
   Processing 415 characters of conversation...
✅ Fact extraction completed in 3.3s
💾 Facts saved to myconversation.jsonld
📊 Saved 3 entities and 2 relationships as JSON-LD

When to use:

  • Extract key information discussed in the conversation
  • Create structured knowledge from chat sessions
  • Document facts for later reference or analysis
  • Generate semantic data for knowledge graphs

🏷️ /tooltag - Test Tool Call Tag Rewriting

Test tool call tag rewriting with custom tags to verify compatibility with different agentic CLIs.

# Test LLaMA3 format (Crush CLI)
/tooltag '' ''

# Test XML format (Gemini CLI)
/tooltag '' ''

# Test Qwen3 format (Codex CLI)
/tooltag '<|tool_call|>' ''

# Test custom format
/tooltag '' ''

When to use:

  • Test compatibility with specific agentic CLIs
  • Verify tool call tag rewriting works correctly
  • Debug tool call format issues
  • Compare different tag formats side by side

💡 Usage Examples

Complete Workflow Example

# Start CLI with a model that supports auto-compaction
python -m abstractcore.utils.cli --provider ollama --model gemma3:1b

# Have a long conversation...
👤 You: What is Python?
🤖 Assistant: Python is a high-level programming language...

👤 You: What about data types?
🤖 Assistant: Python has several built-in data types...

# Check history
👤 You: /history 2

# Change system prompt for specific task
👤 You: /system You are an expert Python tutor focused on data science.

# Compact when needed
👤 You: /compact

# Extract facts from the conversation
👤 You: /facts

# Continue conversation with preserved context
👤 You: Can you explain more about functions?
🤖 Assistant: [Responds as Python tutor, refers to previous context]

Controlling Tool Usage

If the AI is calling tools unnecessarily, you can control this behavior:

# Check current system prompt to understand behavior
👤 You: /system

# Update to prevent unnecessary tool calls
👤 You: /system You are a helpful AI assistant. Only use tools when explicitly requested by the user or when necessary to answer a specific question. Do not demonstrate tool capabilities unprompted.

# Now the AI will be less likely to call tools unnecessarily
👤 You: Who are you?
🤖 Assistant: I am an AI assistant. [No tool calls]

✅ Best Practices

Regular History Checks

Use /history n to review recent context and understand conversation flow.

Strategic Compaction

Use /compact when conversation becomes slow, you've covered multiple topics, or before switching contexts.

System Prompt Control

Use /system to adapt AI behavior for different tasks and prevent unwanted tool calls.

Context Verification

After compaction, use /history to verify preserved context and summary quality.

🔧 Technical Details

  • Compaction Model: Uses gemma3:1b for fast, local processing
  • Preservation: Keeps last 6 messages (3 exchanges) by default
  • Fallback: If gemma3:1b unavailable, uses current provider
  • Token Estimation: Provides rough token count estimates
  • Message Types: Distinguishes between system, user, and assistant messages
  • Error Handling: Gracefully handles various scenarios with helpful messages

Related Documentation

Getting Started

Quick setup guide

Media Handling

Universal file attachment system

Vision Capabilities

Image analysis with fallback

Server Guide

OpenAI-compatible REST API

Tool Calling

Universal tool system

Troubleshooting

Common issues and solutions