Skip to content

Commit 6d47542

Browse files
committed
Update README and create AGENTS.md file
1 parent 6bf58ce commit 6d47542

File tree

2 files changed

+33
-0
lines changed

2 files changed

+33
-0
lines changed

AGENTS.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# PAI (Personal AI)
2+
3+
**Agent Name:** PAI
4+
**Plugin:** `opencode-pai-plugin`
5+
**Type:** Core Infrastructure
6+
7+
## Description
8+
PAI is the core Personal AI Infrastructure agent implemented by this plugin. It serves as the primary interface for the OpenCode environment, managing session context, logging, and user interactions.
9+
10+
## Capabilities
11+
- **Context Management:** Automatically loads the `core/SKILL.md` file from the user's skills directory at the start of each session, injecting it as the core system prompt.
12+
- **Event Logging:** Logs all session events, tool calls, and message updates to the `.opencode/history/raw-outputs` directory for audit and debugging purposes.
13+
- **Session Status:** Updates the terminal tab title to reflect the current activity or thought process of the agent.
14+
- **Session Summarization:** Generates a summary of the session in `.opencode/history/sessions` when a session ends (if configured).
15+
16+
## Configuration
17+
The agent's behavior contains some configurable elements via environment variables or file templates:
18+
19+
| Configuration | Description |
20+
| :--- | :--- |
21+
| `core/SKILL.md` | The core system prompt/skill definition file located in `.opencode/skills/core/SKILL.md`. |
22+
| `USER_NAME` | Environment variable to override the user's name (default: "Engineer"). |
23+
24+
## Codebase Structure
25+
- `src/index.ts`: The plugin entry point. It defines the `PAIPlugin` export and sets up hooks for event listening (`event`, `chat.message`, `tool.execute.after`).
26+
- `src/lib/context-loader.ts`: Responsible for reading and processing the `core/SKILL.md` file, injecting environment variables.
27+
- `src/lib/logger.ts`: Implements a buffering JSONL logger. It captures events and tool outputs, writing them to `raw-outputs/{session-id}.jsonl`. It handles file creation and flushing.
28+
- `src/lib/notifier.ts`: A utility to send POST requests to a local voice server (defaulting to `localhost:8888`). It fails gracefully (silently ignores errors) if the server is not unreachable.
29+
- `src/lib/paths.ts`: Contains helper functions for resolving paths (`getHistoryDir`, `getRawOutputsDir`, `getSkillsDir`) and handling environment variable expansion in paths.

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,7 @@ Once installed and registered, the plugin will automatically:
3535
* Log all events and tool calls to the `.opencode/history/raw-outputs` directory.
3636
* Update the terminal tab title with the current session status.
3737
* Create a session summary in `.opencode/history/sessions` when a session ends.
38+
39+
---
40+
41+
**Disclaimer:** This project is not built by the OpenCode team and is not affiliated with them in any way.

0 commit comments

Comments
 (0)