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

codagent

v0.2.10

Published

A clone of Claude Code using Replicate and Ollama models

Downloads

304

Readme

🤖 Codagent

npm version License: MIT

Codagent is a powerful, autonomous CLI agent designed for software engineering tasks. Inspired by Claude Code, it provides a seamless interface for interacting with local and cloud-based AI models to manage your codebase, execute commands, and solve complex problems.


🚀 Quick Start

Run Codagent instantly without installation using npx:

npx codagent "Explain the architecture of this project"

Or install it globally for frequent use:

npm install -g codagent
codagent "How do I use this agent?"

✨ Features

  • 🧠 Autonomous Thinking Loop: Analyzes tasks, plans actions, and executes them iteratively.
  • 🛠️ Built-in Toolset:
    • read_file: Analyze code directly.
    • write_file: Implement fixes and new features.
    • list_files: Navigate your project structure.
    • create_directory: Scaffold new folders (recursive, idempotent).
    • execute_shell: Run tests, builds, and scripts (with user confirmation).
  • 🌐 Multi-Provider Support:
    • Ollama: Run privacy-focused models locally (e.g., Llama 3, DeepSeek).
    • Replicate: Access world-class cloud models (e.g., Llama 3 70B).
  • 🔍 Deep Thinking: Enable self-reflection loops for higher-quality reasoning and problem-solving.
  • 🗒️ Plan Mode: Investigate read-only and produce a written plan you approve before any change runs. See readme/plan-mode.md.
  • 🐳 Docker Ready: Fully containerized for consistent environments.

🛠️ Configuration

Codagent uses environment variables for configuration. You can set these in your shell or a .env file in your project root.

| Variable | Description | Default | | :--- | :--- | :--- | | DEFAULT_PROVIDER | ollama or replicate | ollama | | DEFAULT_MODEL | The AI model to use | llama3 | | OLLAMA_BASE_URL | URL for your local Ollama instance | http://localhost:11434 | | REPLICATE_API_TOKEN | Your Replicate API token | (Required for Replicate) | | DEEP_THINKING | Enable self-reflection loops | false | | PLAN_MODE | Start in plan mode (read-only + approval gate) | false | | MAX_THINKING_LOOPS | Max self-reflection iterations | 2 |


📖 Usage Guide

Command Line Interface

# Basic prompt
codagent "Create a new React component called UserProfile"

# Enable Deep Thinking for complex tasks
codagent --deep-thinking "Refactor the database layer for better performance"

# Plan mode: investigate first, approve before any change runs
codagent --plan "refactor the auth layer"

# Specify a provider and model
codagent --provider replicate --model meta/meta-llama-3-70b-instruct "Write a blog post about AI"

Headless mode (embedding in other tools)

codagent can be embedded as a non-interactive subprocess. The combination --exec --json --yes is the recommended preset:

# Pass prompt as argument
codagent --exec --json --yes "list the files in this folder"

# Pipe prompt via stdin
echo "describe this project" | codagent --exec --json --yes

| Flag | Effect | | :--- | :--- | | --exec | Run the prompt once and exit. Skips the interactive REPL. Reads from stdin when no positional prompt is given. | | --json | Emit NDJSON events on stdout instead of colored text. One JSON object per line. | | --yes | Auto-approve execute_shell confirmations. Required when running without a TTY. |

NDJSON event schema (one object per line):

{"type":"message","content":"..."}
{"type":"tool_use","tool_name":"read_file","parameters":{"path":"README.md"},"tool_id":"json_1700000000000"}
{"type":"tool_result","tool_id":"json_1700000000000","output":"..."}
{"type":"result","result":"Success","stats":{"input_tokens":1234,"output_tokens":567},"model":"llama3"}
{"type":"error","message":"..."}

--exec is incompatible with --plan: plan mode requires interactive approval and cannot run headless.

Local Setup & Development

If you're contributing to Codagent or running from source:

  1. Clone & Install:

    git clone https://github.com/your-repo/codagent.git
    cd codagent
    npm install
  2. Build:

    npm run build
  3. Run:

    node dist/index.js "Your prompt here"

Docker Usage

# Run with Docker Compose
docker compose run agent "What is this project about?"

# Run tests
docker compose run --rm test

🏗️ Architecture

Codagent is built with a modular architecture:

  • Provider Interface: Standardized way to plug in different AI backends.
  • Tool Registry: Easily extendable system to add new capabilities.
  • Agent Core: Orchestrates the reasoning, acting, and reflecting cycle.

📜 License

This project is licensed under the MIT License - see the LICENSE file for details.