Metadata-Version: 2.4
Name: prompt-copilot-cli
Version: 0.5.0
Summary: A simple terminal coding agent built on LangChain with OpenAI-compatible models and durable memory.
Author: Jason Li
License-Expression: Apache-2.0
Project-URL: Homepage, https://github.com/woshiliyihang/prompt-copilot-cli
Project-URL: Repository, https://github.com/woshiliyihang/prompt-copilot-cli
Project-URL: Issues, https://github.com/woshiliyihang/prompt-copilot-cli/issues
Keywords: cli,agent,langchain,langgraph,openai-compatible,coding-assistant
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Software Development :: Libraries
Classifier: Topic :: Utilities
Requires-Python: <3.15,>=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: langchain<2.0,>=1.3
Requires-Dist: langchain-openai<2.0,>=1.1
Requires-Dist: langgraph<2.0,>=1.2
Requires-Dist: langgraph-checkpoint-sqlite<4.0,>=3.0
Requires-Dist: langmem<1.0,>=0.0.29
Requires-Dist: prompt_toolkit<4.0.0,>=3.0.52
Requires-Dist: rich<16.0.0,>=15.0.0
Dynamic: license-file

﻿# Prompt Copilot CLI

A lightweight terminal coding agent built on LangChain and LangGraph. The project has been refactored to use the standard agent runtime, SQLite-backed persistence, and a small, explicit tool set instead of maintaining a custom agent loop.

## What this project does

Prompt Copilot CLI lets you:

- open a workspace directory and chat with an agent in the terminal
- use a small set of coding tools for reading, searching, editing, and running Python commands
- persist conversation state and durable memories using LangGraph SQLite storage
- connect to an OpenAI-compatible model endpoint such as OpenAI, Azure OpenAI, OpenRouter, or local OpenAI-compatible gateways

## Architecture

```text
CLI
└── AgentRuntime
    ├── ChatOpenAI
    ├── create_agent()
    ├── SummarizationMiddleware
    ├── SqliteSaver
    ├── SqliteStore
    └── LangMem tools
```

The runtime is intentionally minimal:

- `create_agent()` provides the model/tool loop
- `SummarizationMiddleware` compresses long conversations
- `SqliteSaver` persists the current conversation thread
- `SqliteStore` + LangMem handle durable project memory
- tools remain focused on the practical coding workflow

## Install

From the project root:

```powershell
python -m pip install -e .
```

Or install from PyPI:

```powershell
python -m pip install -U prompt-copilot-cli
```

## Initial configuration

The first run creates a config file in:

- Windows: `%USERPROFILE%\.prompt-copilot\config.json`
- Linux/macOS: `~/.prompt-copilot/config.json`

Example:

```json
{
  "model": "gpt-4o-mini",
  "base_url": "https://api.openai.com/v1",
  "api_key": "YOUR_API_KEY",
  "temperature": 0.2,
  "timeout": 120,
  "memory": {
    "enabled": true,
    "max_recent_memories": 5
  },
  "context": {
    "summary_trigger_tokens": 12000,
    "keep_messages": 20
  }
}
```

You can point `base_url` to any OpenAI-compatible endpoint, and the project will use `api_key` from that config file.

## Usage

Start interactive mode:

```powershell
prompt-copilot -d D:\project
```

Run a single task and exit:

```powershell
prompt-copilot -d D:\project -t "Inspect the repo, fix the failing tests, and run the relevant checks."
```

From the CLI, use these commands:

- `/exit` — quit the program
- `/clear` — reset the current workspace thread
- `/memory` — display persistent memories for this workspace

The prompt supports multiline input. Press `Enter` for a newline and `Ctrl+Enter` to submit.

## Available tools

The agent exposes a compact tool set:

- `read_file`
- `list_files`
- `search_code`
- `write_file`
- `edit_file`
- `delete_file`
- `execute_python_script`
- `execute_command`

These are intentionally scoped to file work, code search, editing, and local execution.

## Memory behavior

The runtime uses two persistence layers:

### Short-term memory

`SqliteSaver` stores the live thread state for the current workspace. If you restart the CLI, the same workspace can continue the same conversation.

### Long-term memory

`SqliteStore` stores durable project memory and LangMem exposes memory management tools so the agent can remember useful project conventions or user preferences.

Memory data is stored under:

```text
~/.prompt-copilot/memory.db
```

## Project structure

```text
.
├── main.py
├── copilot/
│   ├── __init__.py
│   ├── agent.py
│   ├── cli.py
│   ├── config.py
│   ├── memory.py
│   └── tools.py
├── tests/
│   ├── test_config.py
│   └── test_tools.py
├── README.md
├── README.zh-CN.md
├── pyproject.toml
└── requirements.txt
```

## Testing

The project is currently verified with:

```powershell
python -m pytest -q
```

Fresh verification in this environment shows:

```text
3 passed in 0.29s
```

The CLI entry point also starts successfully:

```powershell
python main.py --help
```

This confirms the refactored program is runnable in the current environment.

## License

Apache License 2.0
