Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
04b7c0a
refactor: replace litellm with lightweight provider catalog + native …
Nanguage Mar 31, 2026
a033ac2
refactor: remove all litellm naming from codebase
Nanguage Mar 31, 2026
478ba83
fix: capture thinking/reasoning content for Anthropic and Gemini adap…
Nanguage Mar 31, 2026
9b02799
fix: capture Groq reasoning field in stream_chunk_builder
Nanguage Mar 31, 2026
6d44f78
feat: add Codex OAuth support (ChatGPT backend-api)
Nanguage Mar 31, 2026
2025c4e
feat: add Codex OAuth CLI commands, NATS RPC, and model selector inte…
Nanguage Mar 31, 2026
82f2603
fix: don't eagerly refresh on Codex CLI import
Nanguage Mar 31, 2026
8e353e0
fix: only show 'Import from Codex CLI' when ~/.codex/auth.json exists
Nanguage Mar 31, 2026
3a29ea4
feat: add .agents/ directory for AI coding tool context
zqbake Apr 1, 2026
3c22ee8
Merge pull request #56 from aristoteleo/feat/agents-directory
Nanguage Apr 2, 2026
076c8b6
feat: add Ollama as auto-detected local provider
Nanguage Apr 2, 2026
9ab7b0b
fix: propagate LLM errors to frontend via NATS chat_finished event
Nanguage Apr 2, 2026
59b7b29
fix: oauth_status verifies token instead of just checking file exists
Nanguage Apr 2, 2026
2e7b306
fix: user-friendly Codex OAuth error messages with [OAUTH_REQUIRED] tag
Nanguage Apr 2, 2026
efe5b9f
Merge branch 'main' into feature/replace-litellm
Nanguage Apr 3, 2026
b3bdc5a
fix: remove non-existent 'slack' extra from CI test workflow
Nanguage Apr 3, 2026
eaa4053
Merge pull request #60 from aristoteleo/feature/replace-litellm
Nanguage Apr 3, 2026
26dd9c8
Merge pull request #54 from aristoteleo/claw
Starlitnightly Apr 3, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions .agents/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# .agents/

Project context for AI coding assistants (Claude Code, Cursor, Copilot, Windsurf, etc.).

These files help AI tools understand PantheonOS's architecture, conventions, and module
structure so they can provide more accurate and context-aware assistance.

## Files

| File | Description |
|------|-------------|
| [overview.md](overview.md) | Architecture, tech stack, entry points, module reference |
| [conventions.md](conventions.md) | Setup, commands, coding style, testing, do/don't |

## Usage

- **Claude Code**: Reference from `CLAUDE.md` or read directly
- **Cursor**: Copy relevant sections into `.cursor/rules/`
- **Copilot**: Copy relevant sections into `.github/copilot-instructions.md`
- **Other tools**: Use as-is or adapt to the tool's specific format
117 changes: 117 additions & 0 deletions .agents/conventions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
# Conventions

## Environment Setup

```bash
# Create virtual environment and install dependencies
uv sync

# Activate the environment
source .venv/bin/activate

# Install with optional features
uv sync --extra knowledge # RAG/vector search
uv sync --extra claw # Multi-channel gateway (Slack, Telegram, etc.)
uv sync --extra r # R language support
uv sync --extra dev # Development tools (pytest, etc.)
```

## Common Commands

### CLI

```bash
pantheon cli # Start interactive REPL
pantheon ui # Start Chatroom UI (auto-starts NATS)
pantheon setup # Configure LLM provider API keys
pantheon store # Browse/install from Pantheon Store
pantheon update-templates # Refresh .pantheon/ from factory defaults
```

### Testing

```bash
pytest # Run all tests (excluding marked ones)
pytest -m api # Tests requiring API access
pytest -m integration # Tests requiring heavy deps (scanpy)
pytest -m live_llm # Tests requiring live LLM calls (needs OPENAI_API_KEY)
pytest -m "not api and not integration and not live_llm" # Fast local tests only
```

Test markers are defined in `tests/conftest.py`. The conftest also sets up isolated
cache directories (numba, matplotlib, XDG) to avoid side effects.

## Coding Conventions

### Async-First

The codebase is primarily async. Agent message handling, tool execution, and NATS
communication are all async. Use `async def` for new tool methods and agent interactions.

### ToolSet Pattern

All toolsets inherit from `ToolSet` (in `pantheon/toolset.py`). Tools are decorated
with `@tool`:

```python
from pantheon.toolset import ToolSet, tool

class MyToolSet(ToolSet):
@tool
async def my_tool(self, param: str) -> str:
"""Tool description shown to the LLM agent."""
return result
```

Key points:
- `@tool` auto-injects `context_variables` and `session_id` via contextvars
- Use `@tool(exclude=True)` to hide a tool from the LLM
- Access execution context with `get_current_context_variables()`
- Use `context.call_agent()` for intermediate LLM sampling within a tool
- Register new toolsets in `pantheon/toolsets/__init__.py` via `_TOOLSET_MAPPING`

### Lazy Imports

The toolsets module uses lazy `__getattr__` imports to avoid loading heavy dependencies
at startup. Follow this pattern when adding new toolsets:

```python
# In pantheon/toolsets/__init__.py
_TOOLSET_MAPPING = {
"MyNewToolSet": ".my_module",
...
}
```

### Configuration

- Use `pantheon/settings.py` Settings class for accessing config values
- Config files are JSONC (JSON with comments support)
- 3-layer merge: user global > project > factory defaults
- Environment variables and `.env` files can override settings

### Pydantic Models

Use Pydantic for data validation in API boundaries, config models, and tool parameters.

## Do / Don't

### Do

- Write async code for agent and tool interactions
- Inherit from `ToolSet` for new tool groups
- Use litellm for all LLM calls (never call provider APIs directly)
- Add test markers (`@pytest.mark.api`, etc.) for tests with external dependencies
- Use `loguru` logger (`from pantheon.utils.log import logger`)
- Support the 3-layer config hierarchy when adding new settings
- Use lazy imports for heavy dependencies (scanpy, torch, etc.)

### Don't

- Don't call LLM providers directly — always go through litellm
- Don't use synchronous I/O in agent or tool execution paths
- Don't hardcode API keys — use settings or environment variables
- Don't import heavy packages at module top level (use lazy imports)
- Don't modify `pantheon/factory/templates/` for project-specific config
(use `.pantheon/` instead)
- Don't skip `@tool` decorator — it handles context injection and serialization
Loading
Loading