Refactor: Rename AgentLow to Peanut Agent with modular architecture#1
Merged
Refactor: Rename AgentLow to Peanut Agent with modular architecture#1
Conversation
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
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
agentlow-protopeanut-agentsrc/peanut_agent/package layoutsetup.pywith modernpyproject.toml(setuptools-based)Core Agent Implementation
src/peanut_agent/agent.py: New modularPeanutAgentclass that orchestrates the tool-calling loop with OllamaCacheStorefor response memoizationsrc/peanut_agent/config.py: NewAgentConfigdataclass for immutable configurationconfig.pyTool Execution & Security
src/peanut_agent/tools/executor.py: RefactoredToolExecutorwith enhanced securityshell=Trueanywhere — all subprocess calls use argument lists withshlex.split()_safe_path()src/peanut_agent/tools/schemas.py: Extracted tool schemas into dedicated moduleCaching System
src/peanut_agent/cache/store.py: New SQLite-backedCacheStoreCLI & User Interface
src/peanut_agent/cli.py: Rewritten CLI with Rich supportTesting
tests/test_agent.py: Comprehensive test suite using mocked HTTP (no Ollama required)tests/test_executor.py: Security-focused executor teststests/test_cache.py: Cache store teststests/test_config.py: Configuration testsDocumentation & Configuration
README.md: Completely rewritten with focus on quick start and securityCHANGELOG.md: Updated to reflect v2.0.0 releaseCONTRIBUTING.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 directoriesRemoved Files
agent.py,https://claude.ai/code/session_01K1TCHDY1KY5A3mbCRvsmqC