Skip to content

Comments

Refactor: Rename AgentLow to Peanut Agent with modular architecture#1

Merged
smouj merged 1 commit intomainfrom
claude/improve-peanut-agent-RJeDT
Feb 12, 2026
Merged

Refactor: Rename AgentLow to Peanut Agent with modular architecture#1
smouj merged 1 commit intomainfrom
claude/improve-peanut-agent-RJeDT

Conversation

@smouj
Copy link
Owner

@smouj smouj commented Feb 12, 2026

Summary

This PR completely restructures the project from "AgentLow Pro" to "Peanut Agent" with a modern, modular architecture. The codebase has been reorganized into a proper Python package under src/peanut_agent/ with clear separation of concerns: configuration, agent orchestration, tool execution, caching, and CLI.

Key Changes

Project Structure & Naming

  • Renamed project from agentlow-pro to peanut-agent
  • Reorganized into standard src/peanut_agent/ package layout
  • Replaced setup.py with modern pyproject.toml (setuptools-based)
  • Updated all imports and module references throughout

Core Agent Implementation

  • src/peanut_agent/agent.py: New modular PeanutAgent class that orchestrates the tool-calling loop with Ollama

    • Cleaner separation between message handling, tool dispatch, and response caching
    • Integrated CacheStore for response memoization
    • Improved error handling and logging
  • src/peanut_agent/config.py: New AgentConfig dataclass for immutable configuration

    • Environment variable support (PEANUT_* prefix)
    • Centralized security allowlists and timeouts
    • Replaces scattered config in old config.py

Tool Execution & Security

  • src/peanut_agent/tools/executor.py: Refactored ToolExecutor with enhanced security

    • No shell=True anywhere — all subprocess calls use argument lists with shlex.split()
    • Path traversal prevention on every file operation via _safe_path()
    • Allowlist-based command validation with forbidden pattern detection
    • Timeouts on all external calls (shell, HTTP, git, docker)
    • Cleaner error messages and logging
  • src/peanut_agent/tools/schemas.py: Extracted tool schemas into dedicated module

    • JSON Schema definitions for Ollama function calling
    • Improved documentation for each tool's parameters

Caching System

  • src/peanut_agent/cache/store.py: New SQLite-backed CacheStore
    • Persistent response caching with TTL support
    • Hit/miss statistics tracking
    • WAL mode for concurrent access

CLI & User Interface

  • src/peanut_agent/cli.py: Rewritten CLI with Rich support
    • Interactive chat mode and single-command execution
    • Preflight connectivity checks
    • Verbose execution details option
    • Cleaner argument parsing with argparse

Testing

  • tests/test_agent.py: Comprehensive test suite using mocked HTTP (no Ollama required)

    • Tests for simple responses, tool calling, caching, and error handling
    • 69 tests total that pass without Ollama running
  • tests/test_executor.py: Security-focused executor tests

    • Validates command allowlist enforcement
    • Tests path traversal prevention
    • Verifies forbidden pattern detection
  • tests/test_cache.py: Cache store tests

    • TTL expiry, hit/miss tracking, concurrent access
  • tests/test_config.py: Configuration tests

    • Environment variable override behavior
    • Default value validation

Documentation & Configuration

  • README.md: Completely rewritten with focus on quick start and security

    • Removed Spanish language content
    • Clearer feature highlights (secure execution, caching, CLI)
    • Updated installation and usage examples
  • CHANGELOG.md: Updated to reflect v2.0.0 release

  • CONTRIBUTING.md: Simplified contribution guidelines

  • .github/workflows/ci.yml: Streamlined CI pipeline (lint, test, coverage)

  • Dockerfile & docker-compose.yml: Updated container names and references

  • .gitignore: Added Peanut-specific cache and IDE directories

Removed Files

  • Old agent.py,

https://claude.ai/code/session_01K1TCHDY1KY5A3mbCRvsmqC

Complete overhaul of the agent system:

Security:
- Eliminate all shell=True usage — subprocess calls use argument lists
- Fix command injection in git/docker tools (was using f-strings + shell)
- Add forbidden pattern detection (rm -rf, sudo, eval, | bash)
- CI includes automated shell=True detection job

Architecture:
- New src/peanut_agent/ package with proper Python packaging
- Modern pyproject.toml replacing broken setup.py
- Immutable dataclass config with env var support (PEANUT_ prefix)
- Modular tools: executor.py (logic) + schemas.py (Ollama definitions)

Features:
- SQLite response cache with TTL expiry and hit/miss stats
- Rich CLI: interactive chat, single-command, preflight check
- System prompt for reliable tool-calling behavior
- Preflight check verifies Ollama connectivity before running

Testing:
- 69 tests covering agent, executor, cache, and config
- All tests run without Ollama (mocked HTTP)
- Tests for path traversal, command injection, forbidden patterns

Removed:
- Old flat files (agent.py, tools.py, config.py, examples.py in root)
- Broken src/agentlow/ package that was never functional
- Docs referencing non-existent features (plugins, streaming, SSH, etc.)
- setup.py replaced by pyproject.toml

https://claude.ai/code/session_01K1TCHDY1KY5A3mbCRvsmqC
@chatgpt-codex-connector
Copy link

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

@smouj smouj merged commit 59ff5ca into main Feb 12, 2026
4 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants