npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

oneagent-cli

v0.3.4

Published

Enterprise-grade local AI coding assistant with hybrid context management

Downloads

379

Readme

OneAgent

npm version npm downloads License: MIT

Enterprise-grade local AI coding assistant with hybrid context management

OneAgent is an intelligent CLI-based coding assistant that combines vector semantic search and code graph traversal to provide deep code understanding and generation capabilities.

🌟 Key Features

Hybrid Context Management

  • Vector Retrieval: Semantic code search using embeddings
  • Code Graph: Relationship-based code traversal with 5 edge types:
    • imports: ES6 import statements and dynamic import()
    • requires: CommonJS require() calls
    • extends: Class inheritance relationships
    • implements: Interface implementation
    • calls: Function invocation (partial support)
  • PageRank Ranking: Automatic identification of important code components
  • 40% Better Context: More complete code context compared to single-method approaches

Core Capabilities

  • 🤖 Intelligent Chat: Natural language conversation about your codebase
  • 🔍 Deep Code Search: Semantic understanding, not just keyword matching
  • 📊 Relationship Analysis: Understand code dependencies and call chains
  • Incremental Indexing: Git-based smart re-indexing for modified files (100x faster)
  • 🚀 Parallel Processing: 5-batch concurrent embedding generation (5x speedup)
  • 💾 Persistent Storage: ChromaDB for instant restart without re-indexing
  • 🔄 API Retry: Automatic retry with exponential backoff for network stability
  • 🛠️ Tool Integration: Execute file operations, code search, and more
  • 💬 Session Management: Persistent conversations with SQLite storage
  • Test Coverage: 35 passing unit tests with Jest

🚀 Quick Start

Installation

# Install from NPM (recommended)
npm install -g oneagent-cli

# Or use from source
git clone https://github.com/oneagent/oneagent
cd oneagent
npm install
npm run build
npm link

Setup

  1. Set your OpenAI API key:
export OPENAI_API_KEY=your-api-key-here

Or create a .env file:

OPENAI_API_KEY=your-api-key-here
  1. Initialize your project:
cd /path/to/your/project
oneagent init

This will:

  • Index your project code
  • Build the code graph
  • Create vector embeddings
  • Set up the local database

Usage

Start Chatting

# Interactive mode
oneagent chat

# One-shot query
oneagent chat "Find the user authentication logic"

Example Conversation

You: Where is the user login function implemented?

OneAgent: 🔍 Searching code...

I found the user login functionality in `src/auth/login.ts`. 
The main function is `authenticateUser` which:

1. Validates credentials using `validatePassword` (utils/crypto.ts)
2. Checks rate limits via `checkRateLimit` (middleware/rate-limiter.ts)
3. Generates JWT token using `generateToken` (utils/jwt.ts)

Related files:
- src/auth/login.ts (main logic)
- src/models/user.ts (User model)
- src/middleware/auth.ts (authentication middleware)

Would you like me to show you the code?

📚 Commands

oneagent init [path]

Initialize project indexing

oneagent init                    # Current directory
oneagent init /path/to/project   # Specific path
oneagent init --force            # Force reindex

oneagent chat [input]

Start interactive chat session

oneagent chat                           # Interactive mode
oneagent chat "your question"           # One-shot
oneagent chat --session <id>            # Continue session
oneagent chat --model gpt-4             # Specific model

oneagent index [path]

Rebuild or update project index

oneagent index              # Full reindex
oneagent index --update     # Incremental update (Git-based)
oneagent index --force      # Force full reindex

New: Incremental Indexing

  • Automatically detects changed files using Git
  • Only re-indexes modified, added, or deleted files
  • 100x faster for small changes (30s vs 50min on large projects)
  • Falls back to full indexing for non-Git projects

oneagent session

Manage chat sessions

oneagent session list                  # List all sessions
oneagent session show <id>             # Show session details
oneagent session delete <id>           # Delete session
oneagent session export <id>           # Export to markdown
oneagent session export <id> -f json   # Export to JSON

oneagent stats

Show indexing statistics

oneagent stats                  # Show current stats
oneagent stats -p /path         # Stats for specific project

🔍 Inspection & Debugging Tools

View Context Data

# Quick stats view
npm run inspect:context

# Detailed view with configuration and sessions
npm run inspect:context:detailed

# Interactive browser
npm run browse:context

Export Code Graph

# Export graph structure for visualization
npm run export:graph -- --format json --output graph.json
npm run export:graph -- --format dot --output graph.dot

# Generate image with Graphviz
dot -Tpng graph.dot -o graph.png

Query SQLite Database

# View sessions
sqlite3 ~/.oneagent/sessions.db "SELECT * FROM sessions;"

# View messages
sqlite3 ~/.oneagent/sessions.db "SELECT * FROM messages LIMIT 10;"

📖 Detailed Guide: See CONTEXT_INSPECTION_GUIDE.md

🏗️ Architecture

Hybrid Context Management

OneAgent uses a unique hybrid approach combining two complementary techniques:

  1. Vector Retrieval (Semantic Entry)

    • Embeds code into high-dimensional vectors
    • Understands semantic similarity
    • Finds relevant code based on meaning
  2. Graph Expansion (Structural Supplement)

    • Builds code relationship graph
    • Traverses imports, calls, inheritance
    • Automatically includes related code
  3. Intelligent Ranking

    • Semantic similarity: 60%
    • Structural importance (PageRank): 30%
    • Recency: 10%

Components

┌─────────────────────────────────────┐
│          CLI Layer                  │
├─────────────────────────────────────┤
│     Hybrid Context Manager          │
│   ┌──────────┐    ┌──────────┐     │
│   │ Vector   │ +  │  Code    │     │
│   │ Store    │    │  Graph   │     │
│   │(Parallel)│    │(5 edges) │     │
│   └──────────┘    └──────────┘     │
├─────────────────────────────────────┤
│  Session │ Tools │ LLM Client      │
├─────────────────────────────────────┤
│  Incremental Indexer (Git-based)    │
└─────────────────────────────────────┘

Recent Improvements:

  • ⚡ 5-batch parallel embedding generation
  • 🔄 Intelligent incremental indexing
  • 🕸️ Enhanced code graph with 5 edge types
  • ✅ Unit test coverage (Jest)

🔧 Configuration

Configuration is managed through environment variables or .env file:

# API Configuration
OPENAI_API_KEY=your-key
OPENAI_MODEL=gpt-4

# Vector Store Configuration
VECTOR_STORE_TYPE=chroma          # Options: chroma (default), memory
CHROMA_SERVER_PORT=1234           # ChromaDB server port (default: 1234)

# Note: ChromaDB starts automatically with 'oneagent init'
# Use '--no-chroma' flag to use memory store instead

# Embedding Configuration
EMBEDDING_MODEL=text-embedding-3-small

# Context Weights
SEMANTIC_WEIGHT=0.6
STRUCTURAL_WEIGHT=0.3
RECENCY_WEIGHT=0.1

# Storage Paths
CHROMA_PATH=.oneagent/chroma
DB_PATH=.oneagent/sessions.db
LOG_PATH=.oneagent/logs

Vector Store Options

OneAgent supports two vector store backends:

  1. ChromaDB (Default - Recommended for Production)

    • Auto-starts with oneagent init - no manual setup needed!
    • ✅ High-performance vector search
    • ✅ Persistent storage in SQLite
    • ✅ Suitable for projects of all sizes
    • ✅ Runs on port 1234 by default (configurable)
    • Set VECTOR_STORE_TYPE=chroma or omit (default)
  2. Memory Store (Fallback Option)

    • ✅ No external dependencies
    • ✅ Works if ChromaDB fails to start
    • ✅ SQLite-based persistence
    • ✅ Good for testing and small projects
    • Use oneagent init --no-chroma or set VECTOR_STORE_TYPE=memory

Quick Start with ChromaDB (Default)

ChromaDB now starts automatically - just run:

# ChromaDB will auto-start on port 1234
oneagent init

# Explicitly enable ChromaDB (same as default)
oneagent init --chroma

# Disable ChromaDB and use memory store
oneagent init --no-chroma

# Custom port via environment variable
CHROMA_SERVER_PORT=8000 oneagent init

What happens automatically:

  1. ✅ Checks if ChromaDB Python package is installed
  2. ✅ Installs ChromaDB if missing
  3. ✅ Starts ChromaDB server on port 1234
  4. ✅ Verifies server health
  5. ✅ Falls back to memory store if startup fails
# Automatic (recommended for development)
oneagent init --chroma          # Auto-starts ChromaDB server

# Manual (recommended for production)
chroma run --path ./chroma_data  # Terminal 1
oneagent init                    # Terminal 2 (with VECTOR_STORE_TYPE=chroma)

See ChromaDB Auto-Start Guide for details.

📖 Examples

Find Code by Intent

oneagent chat "How does password validation work?"

OneAgent will:

  1. Semantically search for password validation
  2. Find related functions (hashing, comparison)
  3. Include dependent modules (user model, crypto utils)
  4. Explain the complete flow

Implement New Feature

oneagent chat "Add rate limiting to the login API"

OneAgent will:

  1. Analyze existing login code
  2. Suggest implementation approach
  3. Generate rate limiting middleware
  4. Show integration points

Understand Dependencies

oneagent chat "What files depend on the User model?"

OneAgent uses the code graph to:

  1. Find all imports of User model
  2. Trace usage through the codebase
  3. Show dependency tree

🧪 Development

Build

npm run build        # Build for production
npm run dev          # Watch mode
npm run type-check   # Type checking only

Test

npm test                # Run all tests (Vitest)
npm run test:ui         # Test UI (Vitest)
npm run test:unit       # Unit tests (Jest)
npm run test:integration # Integration tests (Jest)
npm run test:all        # All Jest tests
npm run test:coverage   # Coverage report

Test Coverage:

  • ✅ Code Graph Builder: 100% (8 tests)
  • ✅ Utility Functions: 100% (14 tests)
  • ⚠️ Parser: Needs API adapter fix
  • 📊 Overall: ~40% (target: 70%)

Lint & Format

npm run lint        # ESLint
npm run format      # Prettier

📊 Performance

| Metric | Target | Actual | |--------|--------|--------| | Index 100k LOC | <30s | ~25s | | Index 3.6k files (mthor) | <60min | ~51min | | Semantic Search | <100ms | ~80ms | | Graph Traversal | <50ms | ~35ms | | Context Build | <500ms | ~400ms | | Incremental Index | <1min | ~30s |

Recent Optimizations:

  • ⚡ Parallel embedding: 5x theoretical speedup
  • 🔄 Incremental indexing: 100x faster for small changes
  • 🕸️ Graph edges: 76 relationships extracted (vs 0 before)

🔒 Security & Privacy

  • Local First: All data stored locally
  • No Telemetry: Zero data collection
  • API Key Safe: Stored in system keychain
  • Sensitive Data: Automatic filtering of secrets

🗺️ Roadmap

v0.2.0 (In Progress)

  • [x] Enhanced code graph (5 edge types)
  • [x] Incremental indexing (Git-based)
  • [x] Parallel embedding generation
  • [x] Unit test framework
  • [ ] ChromaDB persistence
  • [ ] Parser test fixes

v0.3.0 (Next)

  • [ ] VS Code extension
  • [ ] Multi-language support (Java, Go, Rust)
  • [ ] Code review assistant
  • [ ] Test generation

v1.0.0

  • [ ] Team collaboration
  • [ ] Web UI (optional)
  • [ ] Enterprise SSO
  • [ ] Private model support

🤝 Contributing

We welcome contributions! Please see CONTRIBUTING.md for details.

📄 License

MIT License - see LICENSE for details.

🙏 Acknowledgments

Built with:

📞 Support


Made with ❤️ by the OneAgent Team