Metadata-Version: 2.4
Name: pascal-agent
Version: 0.3.0
Summary: Pascal — autonomous AI employee runtime with 4-layer safety
Project-URL: Homepage, https://gitlab.com/laum0621/pascal
Project-URL: Repository, https://gitlab.com/laum0621/pascal
Project-URL: Issues, https://gitlab.com/laum0621/pascal/-/issues
Author: laum0621
License: MIT
Keywords: agent,ai,autonomous,employee,llm,tool-use
Classifier: Development Status :: 3 - Alpha
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Requires-Python: >=3.12
Requires-Dist: httpx>=0.27
Requires-Dist: openai>=1.0
Provides-Extra: all
Requires-Dist: aiogram>=3.0; extra == 'all'
Requires-Dist: anthropic>=0.30; extra == 'all'
Requires-Dist: mcp; extra == 'all'
Requires-Dist: pillow; extra == 'all'
Requires-Dist: pyautogui; extra == 'all'
Requires-Dist: pyperclip; extra == 'all'
Requires-Dist: pytest; extra == 'all'
Requires-Dist: pytest-asyncio; extra == 'all'
Requires-Dist: pywinauto>=0.6.8; extra == 'all'
Provides-Extra: anthropic
Requires-Dist: anthropic>=0.30; extra == 'anthropic'
Provides-Extra: browser
Requires-Dist: playwright; extra == 'browser'
Provides-Extra: clipboard
Requires-Dist: pyperclip; extra == 'clipboard'
Provides-Extra: desktop
Requires-Dist: pillow; extra == 'desktop'
Requires-Dist: pyautogui; extra == 'desktop'
Provides-Extra: dev
Requires-Dist: pytest; extra == 'dev'
Requires-Dist: pytest-asyncio; extra == 'dev'
Provides-Extra: mcp
Requires-Dist: mcp; extra == 'mcp'
Provides-Extra: ocr
Requires-Dist: pytesseract; extra == 'ocr'
Provides-Extra: telegram
Requires-Dist: aiogram>=3.0; extra == 'telegram'
Provides-Extra: uia
Requires-Dist: pywinauto>=0.6.8; extra == 'uia'
Description-Content-Type: text/markdown

# Pascal — Autonomous AI Employee

An autonomous AI agent that works like a real employee: receives tasks, plans, executes, and reports back.

## Getting Started

### 1. Install

```bash
git clone https://gitlab.com/laum0621/pascal.git
cd pascal
pip install -e ".[all]"
```

### 2. Initialize

```bash
pascal init
```

This creates `~/.pascal/` with a default config file and skills directory.

### 3. Configure your LLM provider

Edit `~/.pascal/pascal.toml`:

```toml
[pascal]
model = "gpt-4o"
provider = "openai"  # openai | anthropic | codex
```

**Provider setup:**

| Provider | Auth | How |
|----------|------|-----|
| OpenAI | API key | `export OPENAI_API_KEY=sk-...` |
| Anthropic | API key | `export ANTHROPIC_API_KEY=sk-ant-...` |
| Codex | ChatGPT Pro OAuth | `codex auth login` (reads `~/.codex/auth.json`) |

### 4. Run a task

```bash
pascal "Create a summary of the files in this directory"
```

## Usage Examples

```bash
# One-shot task
pascal "Write a Python script that downloads weather data"

# Set a mission (persistent context)
pascal --mission "You are a data analyst for the marketing team"

# Check current state
pascal --status

# Always-on daemon with Telegram
pascal --daemon

# Run scheduler tick (for cron)
pascal --tick

# Resume a paused task
pascal --resume task_abc123
```

## Configuration

### Config file (`~/.pascal/pascal.toml`)

```toml
[pascal]
model = "gpt-4o"
provider = "openai"           # openai | anthropic | codex
db_path = "~/.pascal/state.db"
max_effect = "E2"             # E0=read E1=analyze E2=write E3=push E4=merge E5=delete
max_tool_rounds = 10          # max tool calls per LLM turn
```

### Environment variables (override config file)

```bash
PASCAL_MODEL=gpt-4o
PASCAL_PROVIDER=openai
PASCAL_MAX_EFFECT=E2
PASCAL_SLACK_WEBHOOK=https://hooks.slack.com/...
PASCAL_DISCORD_WEBHOOK=https://discord.com/api/webhooks/...
```

### Optional integrations

**Telegram bot** (`~/.pascal/telegram.json`):
```json
{"bot_token": "123:ABC...", "owner_chat_id": 12345}
```

**MCP tool servers** (`~/.pascal/mcp.json`):
```json
[{"name": "chrome", "command": "npx", "args": ["chrome-devtools-mcp@latest"]}]
```

**Custom skills** (`~/.pascal/skills/my-skill.md`):
```yaml
---
name: my-skill
description: What this skill does
---
Instructions for Pascal when this skill is activated...
```

## How It Works

```
You give a task
    |
    v
+---------------------------+
|  Desk compiles state      |  SQLite -> text prompt
|  LLM decides next action  |  22 action types
|  Execute through safety   |  Effect Ladder + Trust Scanner + Sandbox
|  Record to audit ledger   |  Hash-chained, append-only
|  Repeat                   |
+---------------------------+
    |
    v
Task complete / wait / escalate
```

**22 actions**: think, execute, plan, delegate, pick_task, create_task, create_subtask, complete_task, fail_task, pause_task, block_task, handle_notification, dismiss_notification, add_todo, complete_todo, memorize, add_rule, remove_rule, set_context, wait, escalate

**3 LLM providers**: OpenAI, Anthropic Claude, Codex (ChatGPT Pro)

**Safety layers**: Effect Ladder (E0-E5) | Trust Scanner | Sandbox (Docker/Restricted) | TrustMap | Audit Ledger

## Daemon Mode

Always-on operation with Telegram integration:

```bash
# Setup Telegram first
echo '{"bot_token": "YOUR_TOKEN", "owner_chat_id": YOUR_ID}' > ~/.pascal/telegram.json

# Start daemon
pascal --daemon
```

Features:
- Telegram DM for tasks and approvals
- Adaptive heartbeat (5min active, 30min idle)
- Auto-restart on crash
- STOP/PAUSE control (`~/.pascal/STOP` or `~/.pascal/PAUSE` file)
- Self-evolving strategy (adjusts based on success/failure rate)

## Development

```bash
pip install -e ".[dev]"

# Tests (242 pass)
pytest

# Lint (0 errors)
ruff check src/ tests/

# Type check (0 errors)
mypy src/pascal/
```

## Project Structure

```
src/pascal/
  loop.py ........... Core tool-use loop (LoopRunner)
  actions.py ........ 22 action handlers (ActionContext)
  state.py .......... SQLite persistence (9 tables, FTS5)
  desk.py ........... State -> LLM prompt compiler
  tools.py .......... Built-in tools (file, desktop, UIA, clipboard)
  effect.py ......... Effect Ladder (E0-E5, hard regex rules)
  trust.py .......... Input scanner (injection, credentials, destructive)
  capability.py ..... Domain trust map (asymmetric learning)
  sandbox.py ........ Docker + Restricted sandbox
  receipts.py ....... Hash-chained audit ledger
  scheduler.py ...... Cron tick + self-evolution
  daemon.py ......... Always-on mode (Telegram + loop + scheduler)
  config.py ......... Config loader (CLI > env > TOML > defaults)
  schemas.py ........ Tool JSON schemas for LLM function calling
  prompt.py ......... System prompt
  types.py .......... Shared DTOs
  llm/ .............. OpenAI, Anthropic, Codex providers
  channels/ ......... Telegram adapter
  uia.py ............ Windows UI Automation
```

## License

MIT
