Skip to content

Ruanyuxi1337/claude-code

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

148 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

learn-claude-code (feature-custom-agent) 🤖

Interactive CLI client and custom hooks framework extending the core AI Coding Agent loops.

This repository features the development of the standalone console execution loop and authorization gates simulating real-world secure terminal workflows.


🏗️ Architecture Flow

                      +-----------------------------+
                      |      User Command Input     |
                      +--------------+--------------+
                                     |
                                     v
                      +--------------v--------------+
                      |       ReAct Engine Core     | <---+
                      +--------------+--------------+     |
                                     |                    |
                                 Tool Call                |
                                     |               Loop Cycles
                                     v                    |
                      +--------------v--------------+     |
                      |   Permission Hook (Y/N Gate) |     |
                      +-------+--------------+------+     |
                              |              |            |
                         [Approved]       [Denied]        |
                              |              |            |
                              v              v            |
                      +-------v------+ +-----v------+     |
                      | Run Terminal | | Feed Deny  | ────┘
                      |  Subprocess  | | Error Msg  |
                      +--------------+ +------------+

🌟 Key Capabilities

  1. Interactive Console Client (claude-code-cli.py): An offline-first terminal client wrapping the ReAct executor. Provides colorful logging, interactive shell prompting, and step-by-step thinking loop inspection.
  2. Permission Hook Gate: Secures critical tool executions (such as running shell subprocesses via bash). Intercepts execution requests and triggers a manual validation prompt: 👉 是否批准该操作?[y/N]: If the user denies authorization, a clean permission error payload is fed back to the LLM agent's context, maintaining loop integrity without crashing the service thread.
  3. High-Fidelity Mock Mode: Allows developers to debug agent reasoning sequences locally and offline without triggering API charges, switching to mock states when ANTHROPIC_API_KEY is not detected.

📂 Project Layout

├── agents/                  # Multi-agent coordination helpers
├── s01_agent_loop/          # Basic ReAct iteration scripts
├── s02_tool_use/            # Tool definition & schemas
├── s03_permission/          # Permission intercepts
├── s04_hooks/               # Lifecycle hook orchestrator
├── s20_comprehensive/       # Composite Agent engine build
├── claude-code-cli.py       # Standalone interactive CLI app (Production wrapper)
└── README.md                # Project documentation

🚀 Usage

Prerequisites

  • Python 3.10+

Run Standalone Interactive Agent

# Start CLI client (Auto-detects API keys in environment)
python3 claude-code-cli.py

Try Commands

  • Generate files: "Create a simple Python utility that parses arguments"
  • Run Shell Checks: "Run ruff check on this directory" (Intercepted by Permission Gate)

About

No description, website, or topics provided.

Resources

License

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors