@pmndrs/pine 0.0.0-stage → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (117) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +180 -2
  3. package/bin/pine.js +27 -0
  4. package/docs/SKILL.md +189 -0
  5. package/docs/references/agents.md +368 -0
  6. package/docs/references/coding.md +126 -0
  7. package/docs/references/configuration.md +229 -0
  8. package/docs/references/events.md +263 -0
  9. package/docs/references/mcp.md +257 -0
  10. package/docs/references/operations.md +280 -0
  11. package/docs/references/overview.md +186 -0
  12. package/docs/references/security.md +489 -0
  13. package/docs/references/setup.md +181 -0
  14. package/docs/references/sources.md +768 -0
  15. package/docs/references/stack.md +105 -0
  16. package/docs/references/tui.md +348 -0
  17. package/examples/home/.env.example +5 -0
  18. package/examples/home/USER.md +4 -0
  19. package/examples/home/agents/main/agent.json +4 -0
  20. package/examples/home/agents/main/workspace/AGENTS.md +14 -0
  21. package/examples/home/agents/main/workspace/MEMORY.md +4 -0
  22. package/examples/home/agents/main/workspace/SOUL.md +4 -0
  23. package/examples/home/models.json +62 -0
  24. package/examples/home/pine.json +30 -0
  25. package/examples/home/skills/README.txt +7 -0
  26. package/examples/launchd/com.pine.daemon.plist +32 -0
  27. package/mcp/browser.d.ts +34 -0
  28. package/mcp/browser.js +228 -0
  29. package/mcp/commands.d.ts +20 -0
  30. package/mcp/commands.js +88 -0
  31. package/mcp/lib.d.ts +13 -0
  32. package/mcp/lib.js +50 -0
  33. package/mcp/web.d.ts +6 -0
  34. package/mcp/web.js +140 -0
  35. package/package.json +32 -4
  36. package/src/agent-admin.d.ts +24 -0
  37. package/src/agent-admin.js +55 -0
  38. package/src/agents.d.ts +343 -0
  39. package/src/agents.js +1587 -0
  40. package/src/cli.d.ts +2 -0
  41. package/src/cli.js +526 -0
  42. package/src/config.d.ts +351 -0
  43. package/src/config.js +514 -0
  44. package/src/dev/claude-model.d.ts +28 -0
  45. package/src/dev/claude-model.js +174 -0
  46. package/src/env-file.d.ts +4 -0
  47. package/src/env-file.js +40 -0
  48. package/src/http.d.ts +46 -0
  49. package/src/http.js +407 -0
  50. package/src/limiter.d.ts +32 -0
  51. package/src/limiter.js +84 -0
  52. package/src/login.d.ts +21 -0
  53. package/src/login.js +126 -0
  54. package/src/manual.d.ts +61 -0
  55. package/src/manual.js +425 -0
  56. package/src/mcp-config.d.ts +40 -0
  57. package/src/mcp-config.js +132 -0
  58. package/src/net.d.ts +36 -0
  59. package/src/net.js +122 -0
  60. package/src/pine.d.ts +32 -0
  61. package/src/pine.js +142 -0
  62. package/src/router.d.ts +56 -0
  63. package/src/router.js +164 -0
  64. package/src/sandbox-fs.d.ts +27 -0
  65. package/src/sandbox-fs.js +172 -0
  66. package/src/security.d.ts +121 -0
  67. package/src/security.js +363 -0
  68. package/src/skills.d.ts +67 -0
  69. package/src/skills.js +163 -0
  70. package/src/source-types.d.ts +61 -0
  71. package/src/source-types.js +1 -0
  72. package/src/sources/command.d.ts +4 -0
  73. package/src/sources/command.js +77 -0
  74. package/src/sources/folder.d.ts +6 -0
  75. package/src/sources/folder.js +116 -0
  76. package/src/sources/ftp.d.ts +4 -0
  77. package/src/sources/ftp.js +307 -0
  78. package/src/sources/http.d.ts +4 -0
  79. package/src/sources/http.js +201 -0
  80. package/src/sources/mqtt.d.ts +18 -0
  81. package/src/sources/mqtt.js +97 -0
  82. package/src/sources/telegram.d.ts +22 -0
  83. package/src/sources/telegram.js +269 -0
  84. package/src/sources/webhook.d.ts +4 -0
  85. package/src/sources/webhook.js +52 -0
  86. package/src/sources.d.ts +339 -0
  87. package/src/sources.js +955 -0
  88. package/src/store.d.ts +89 -0
  89. package/src/store.js +251 -0
  90. package/src/timers.d.ts +83 -0
  91. package/src/timers.js +318 -0
  92. package/src/tools.d.ts +6 -0
  93. package/src/tools.js +777 -0
  94. package/src/tui/app.d.ts +209 -0
  95. package/src/tui/app.js +2223 -0
  96. package/src/tui/client.d.ts +178 -0
  97. package/src/tui/client.js +116 -0
  98. package/src/tui/code-pane.d.ts +51 -0
  99. package/src/tui/code-pane.js +398 -0
  100. package/src/tui/highlight.d.ts +8 -0
  101. package/src/tui/highlight.js +86 -0
  102. package/src/tui/picture.d.ts +141 -0
  103. package/src/tui/picture.js +571 -0
  104. package/src/tui/run.d.ts +8 -0
  105. package/src/tui/run.js +97 -0
  106. package/src/tui/theme.d.ts +32 -0
  107. package/src/tui/theme.js +128 -0
  108. package/src/types.d.ts +124 -0
  109. package/src/types.js +1 -0
  110. package/src/update.d.ts +25 -0
  111. package/src/update.js +110 -0
  112. package/src/util.d.ts +32 -0
  113. package/src/util.js +116 -0
  114. package/src/watching.d.ts +20 -0
  115. package/src/watching.js +68 -0
  116. package/src/workspace-view.d.ts +38 -0
  117. package/src/workspace-view.js +160 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Paul Henschel
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,181 @@
1
- # Temporary Holding Version
1
+ <h1 align="center">
2
+ <picture>
3
+ <source media="(prefers-color-scheme: dark)" srcset="docs/images/logo-dark.svg">
4
+ <img src="docs/images/logo-light.svg" alt="pine" width="360">
5
+ </picture>
6
+ </h1>
2
7
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
8
+ <div align="center">
9
+ <code>
10
+ + OpenCode, inspired by its interactive TUI
11
+ + OpenClaw automation, without the weight & complexity
12
+ + PI coding agent for basic turns, auto compact and model providers
13
+ -------------------------------------------------------------------
14
+ = PINE
15
+ </code>
16
+ </div>
17
+ <br/>
18
+
19
+ This is a small daemon that runs AI agents. Yes, you've heard that before. Some things it does very differently:
20
+
21
+ - **Letting agents react to external events**: chat, FTP, webhooks, MQTT, web addresses, schedules, etc. In a simple, modular way, and without configs. Agents can subscribe to any installed event source and react accordingly, or list available sources and unsubscribe. Event sources are simple to create, it's a \*.ts service with a schema. This allows you to create full automation workflows by just stating what you want: "watch my security cam, ring the alarm if someone enters while i'm away".
22
+ - **No configs**: you tell the agent what you want. They operate through safe tool calls. Main agent can create other agents, global MCPs, event sources, skills, schedules, etc. Other agents can create these either for local conversations or their scope. No agent will touch or bypass into user config (where your tokens are).
23
+ - **A CLI that feels new**. Like a desktop UI. Interactive tabs, buttons, scroll regions. Images and videos are actually shown, formats markdown. Drag and drop files with real thumbails - and yes it's running in your shell (all Kitty shells, GHOSTTY et al, with lower quality fallbacks for old terminals).
24
+ - **All basics inbuilt**: computer use, tool calls, internet, browsing and operating live websites
25
+ - **Coding assistance**: diffs, output files, git integration, current folders ...
26
+ - **Orchestrating agents**, sub-agents, ... well, yes it does that. In an intuitive way. A pinned tab is a persistent agent. Create an agent, open a tab, rename it, tell it its basic instructions (these go into AGENTS.md), connect it to event sources, for instance Telegram if you want to chat abroad, pin it, close the tab if you want (you find it back in the running sessions), you're done.
27
+
28
+ <br/>
29
+
30
+ <table>
31
+ <tr>
32
+ <td align="center" width="50%">
33
+ <br />
34
+ <img src="docs/images/meme.png" width="100%" alt="pine searches the web, downloads a picture and shows it in the terminal"><br/>
35
+ <sub>Support for images</sub>
36
+ </td>
37
+ <td align="center" width="50%">
38
+ <br />
39
+ <img src="docs/images/video.gif" width="100%" alt="pine fetches a video from the web and plays it in the terminal"><br/>
40
+ <sub>Support for videos</sub>
41
+ </td>
42
+ </tr>
43
+ <tr>
44
+ <td align="center" width="50%">
45
+ <br />
46
+ <img src="docs/images/drop.png" width="100%" alt="A picture dropped into the terminal, shown as a thumbnail, and the agent's answer about it"><br/>
47
+ <sub>Drag and drop</sub>
48
+ </td>
49
+ <td align="center" width="50%">
50
+ <br />
51
+ <img src="docs/images/watch.png" width="100%" alt="Asked to watch a folder, the agent sets up an event source; a file changes, it wakes up and shows the git diff"><br/>
52
+ <sub>Event sources (file watchers, ...)</sub>
53
+ </td>
54
+ </tr>
55
+ <tr>
56
+ <td align="center" width="50%">
57
+ <br />
58
+ <img src="docs/images/tabs.png" width="100%" alt="Tabs for several agents and conversations, with the list of conversations: pinned ones stay, the others clean themselves up"><br/>
59
+ <sub>UI can be navigated by clicking</sub>
60
+ </td>
61
+ <td align="center" width="50%">
62
+ <br />
63
+ <img src="docs/images/flipper.png" width="100%" alt="pine drives a Flipper Zero through an MCP server"><br/>
64
+ <sub>Support for MCPs and skills</sub>
65
+ </td>
66
+ </tr>
67
+ <tr>
68
+ <td align="center" width="50%">
69
+ <br />
70
+ <img src="docs/images/code.png" width="100%" alt="The code pane beside a conversation: the git diff of a file the agent just changed"><br/>
71
+ <sub>Code assistance</sub>
72
+ </td>
73
+ <td align="center" width="50%">
74
+ <br />
75
+ <img src="docs/images/folder.png" width="100%" alt="pine started in a project folder: the agent inspects it, and the folder menu lists the folders a conversation can work in"><br/>
76
+ <sub>Current folders</sub>
77
+ </td>
78
+ </tr>
79
+ </table>
80
+
81
+ <br/>
82
+
83
+ ```
84
+ you: terminal UI · Telegram
85
+ │
86
+ ▼
87
+ wake it ┌───────────┐ it uses
88
+ events ───────────────► │ │ ◄───────── MCP servers
89
+ Telegram · MQTT · FTP │ │ ◄───────── skills
90
+ webhooks · folders │ agent │
91
+ web addresses │ │
92
+ commands · etc │ │
93
+ schedules ────────────► │ │
94
+ repeating · once └─────┬─────┘
95
+ │ delegate ──► other agents
96
+ │ subagent ──► with distinct prompts, in parallel
97
+ ▼
98
+ answers · messages · actions
99
+
100
+ Events, schedules, MCPs and skills can be set up by asking:
101
+ for the current conversation, agent scope, or globally
102
+ (main agent only) for all agents.
103
+ ```
104
+
105
+ ## Quick start
106
+
107
+ Requires Node 24 or newer and macOS (for the sandbox).
108
+
109
+ ```bash
110
+ npm install -g @pmndrs/pine
111
+ ```
112
+
113
+ Sets everything up: the browser the web tools drive, and your user folder (`~/.pine`).
114
+
115
+ ```bash
116
+ pine init
117
+ ```
118
+
119
+ Checks the setup: validates the configuration, lists each agent with its model, tools and MCP
120
+ servers, and prints security notes if something is open that should not be.
121
+
122
+ ```bash
123
+ pine check
124
+ ```
125
+
126
+ Opens the terminal UI. If no daemon is running, it starts one inside and stops it when you quit.
127
+
128
+ ```bash
129
+ pine
130
+ ```
131
+
132
+ Runs the daemon as a service, without the UI, so agents keep reacting to events with no terminal
133
+ open. `pine` then attaches to it. To have it start at login, see
134
+ [operations.md](docs/references/operations.md).
135
+
136
+ ```bash
137
+ pine start
138
+ ```
139
+
140
+ Connect your subscriptions, orlocal llm servers. Switch with `/model` in the UI:
141
+
142
+ ```bash
143
+ pine login opencode-go
144
+ ```
145
+
146
+ `pine login anthropic` and `pine login openai-codex` use a Claude or ChatGPT subscription; a
147
+ local llama-server goes into `~/.pine/models.json`. See
148
+ [operations.md](docs/references/operations.md) and [tui.md](docs/references/tui.md).
149
+
150
+ To work on a project, start it in that folder. The agent gets that folder for the
151
+ conversation, and `▤ code` (or `ctrl+g`) opens a pane with git changes and diffs, the files and
152
+ the output of its tool calls ([coding.md](docs/references/coding.md)):
153
+
154
+ ```bash
155
+ pine .
156
+ ```
157
+
158
+ To get a newer version later, with whatever it needs:
159
+
160
+ ```bash
161
+ pine update
162
+ ```
163
+
164
+ ## Documentation
165
+
166
+ Start at [docs/SKILL.md](docs/SKILL.md); it indexes everything.
167
+
168
+ | To do this | Read |
169
+ | --------------------------------------------------------------------------------------- | ------------------------------------------------------------ |
170
+ | Understand how the pieces fit | [overview.md](docs/references/overview.md) |
171
+ | Use the terminal UI | [tui.md](docs/references/tui.md) |
172
+ | Work on a project: `pine .`, the code pane with git changes, files and tool output | [coding.md](docs/references/coding.md) |
173
+ | Install, run, use the CLI, run it as a service | [operations.md](docs/references/operations.md) |
174
+ | Write `pine.json` and `agent.json` | [configuration.md](docs/references/configuration.md) |
175
+ | Let agents set things up by tool call instead of editing files | [setup.md](docs/references/setup.md) |
176
+ | Set up agents, delegation and sub-agents | [agents.md](docs/references/agents.md) |
177
+ | Route events, schedules, model calls | [events.md](docs/references/events.md) |
178
+ | Event sources: Telegram, folders, MQTT, web addresses, commands, webhooks, FTP | [sources.md](docs/references/sources.md) |
179
+ | MCP servers, web search, command tools | [mcp.md](docs/references/mcp.md) |
180
+ | Know what is protected and what is not | [security.md](docs/references/security.md) |
181
+ | Work on pine itself | [AGENTS.md](AGENTS.md), [stack.md](docs/references/stack.md) |
package/bin/pine.js ADDED
@@ -0,0 +1,27 @@
1
+ #!/usr/bin/env node
2
+ // pine's launcher. From a checkout it runs the TypeScript sources as they are; from an installed
3
+ // package it runs the compiled ones (Node does not run TypeScript from inside node_modules).
4
+ import { spawnSync } from "node:child_process";
5
+ import fs from "node:fs";
6
+ import path from "node:path";
7
+ import { fileURLToPath, pathToFileURL } from "node:url";
8
+
9
+ if (Number(process.versions.node.split(".")[0]) < 24) {
10
+ console.error(`pine needs Node 24 or newer (this is ${process.versions.node}): https://nodejs.org`);
11
+ process.exit(1);
12
+ }
13
+ // The real place of this file, also when it was started through the link npm puts on the PATH.
14
+ const root = path.resolve(path.dirname(fs.realpathSync(fileURLToPath(import.meta.url))), "..");
15
+ const source = path.join(root, "src", "cli.ts");
16
+ if (fs.existsSync(source)) {
17
+ // A fresh checkout: fetch what pine is built on, once, so that the first command just works.
18
+ if (!fs.existsSync(path.join(root, "node_modules", "@earendil-works", "pi-coding-agent"))) {
19
+ console.error("pine: installing its dependencies (once) ...");
20
+ const done = spawnSync("npm", ["install", "--no-audit", "--no-fund"], { cwd: root, stdio: ["ignore", 2, 2] });
21
+ if (done.status !== 0) {
22
+ console.error(`pine: npm install failed; run it in ${root} to see why`);
23
+ process.exit(1);
24
+ }
25
+ }
26
+ await import(pathToFileURL(source).href);
27
+ } else await import(pathToFileURL(path.join(root, "src", "cli.js")).href);
package/docs/SKILL.md ADDED
@@ -0,0 +1,189 @@
1
+ ---
2
+ name: pine
3
+ description: Run, configure and extend pine, the event-driven multi-agent daemon built on the pi coding agent SDK. Use when setting up agents and their workspaces, subscribing agents to event sources (Telegram, folders, MQTT, webhooks, FTP uploads, web addresses, commands), scheduling what happens at a time, adding MCP servers and skills, routing events to agents, reaching agents on Telegram, delegating between agents, reviewing what is protected against prompt injection, or changing pine's code.
4
+ ---
5
+
6
+ # pine
7
+
8
+ pine (PI neural engine) is one process that hosts several pi agent sessions and an event log.
9
+ Event sources and schedules turn the outside world and the clock into events; subscriptions,
10
+ schedules and routes turn events into work; agents answer, act, hand tasks to each other, and
11
+ publish events of their own.
12
+
13
+ Three things to know before anything else:
14
+
15
+ 1. **Configuration lives in a home directory**, by default `~/.pine`: `pine.json` (global),
16
+ `models.json` (pi's model file), `.env` (secrets), and one folder per agent under `agents/`.
17
+ 2. **An agent is a folder**: `agents/<id>/agent.json` and a workspace. In the workspace lie the
18
+ files the agent keeps itself and that are read into its prompt: `AGENTS.md` (its purpose),
19
+ `SOUL.md` (who it is), `MEMORY.md` (its memory). `USER.md` in the home is what all agents
20
+ know about you. The workspace is wherever `workspace` points, for example a repository.
21
+ 3. **Where content came from decides what it may do.** Your own messages get the agent's full
22
+ tool set. Anything else is data. An event from outside runs with a reduced tool set in a
23
+ separate session; an event from a source a conversation subscribed to arrives in that
24
+ conversation, framed as data, and marks it as having read outside content (unless the source
25
+ is marked as yours). Either way nothing is sent out without your approval.
26
+
27
+ ## If you are an agent running inside pine
28
+
29
+ You search this manual with your `manual` tool: a search names the parts that fit with the
30
+ line that matched, and you then read the one or two parts you need. Search before you answer a
31
+ question about pine or say that something is not possible.
32
+
33
+ pine's configuration lives in its home folder (`~/.pine` unless your owner chose another),
34
+ which is closed to you on purpose: you never write those files. Four things you set up by
35
+ calling a tool, for the conversation you are in or for yourself as an agent
36
+ ([references/setup.md](references/setup.md)): event sources and subscriptions, schedules,
37
+ remote MCP servers, and skills. Creating agents, anything for all agents and new types of
38
+ event source are the main agent's job; if you are not the main agent, send your owner to it.
39
+ For everything else your owner asks about (a route, your built-in tools or model, the sandbox):
40
+
41
+ 1. Search the manual for it and read the part.
42
+ 2. Tell your owner what to put where: usually a few lines of JSON in `pine.json` (for everyone)
43
+ or `agents/<your id>/agent.json` (for you), then `pine check`, then a restart of the daemon
44
+ (quitting and reopening the terminal UI restarts an embedded one).
45
+ 3. Do not try to edit those files or work around the restriction. Say plainly that this is a
46
+ step for them.
47
+
48
+ One thing you can start yourself: when your owner asks you to install or connect a remote MCP
49
+ server and gives you its https URL, call `add_mcp_server` with a short name and that URL. Leave
50
+ the scope out: the server is then for the conversation you are in (in your main conversation:
51
+ for you as an agent). Pass `scope: "agent"` only if they said it is for you in general, and, as
52
+ the main agent, `scope: "global"` only if they said "for all agents". They get a dialog and
53
+ confirm it. `remove_mcp_server` takes one out again. Do not probe the URL first; an
54
+ "unauthorized" answer only means the server wants a sign-in, which your owner does afterwards
55
+ with `/mcp login <name>` in the terminal UI or `pine mcp login <name>` in a shell. Tell them
56
+ that. A local server (a command to run) is theirs to add: `pine mcp add <name> -- <command>`.
57
+
58
+ Another: when your owner asks you to watch something or to react when something happens, call
59
+ your `sources` tool: it lists what you can subscribe to and what you are subscribed to (use it
60
+ too when your owner asks what you are watching). If one fits, subscribe to it with a note that
61
+ says what you are to do; whoever is subscribed is woken with that note whenever it reports
62
+ something. A subscription is for the conversation it is asked for in: that one is woken, and the
63
+ subscription goes when the conversation is closed, reset or removed. So leave the scope out.
64
+ Only when your owner says in so many words that it is for more do you pass one: agent (your
65
+ main conversation is woken instead, and it stays) or, if you are the main agent, global (all
66
+ agents); your owner is then asked to confirm. Do not pick a wider scope yourself; if you think
67
+ they want one, ask. You can end anything your own agent is subscribed to from any of its
68
+ conversations (`unsubscribe` with scope `agent` or `all`). If none fits,
69
+ set one up with `add_source` (a folder to watch, a web address or a command that is looked at
70
+ again and again, an MQTT device, a webhook, an FTP drop, Telegram); your owner confirms it where
71
+ that is needed. A password or token is never yours to handle: leave it out, and pine asks your
72
+ owner for it in a dialog. `remove_source` deletes one for good. Through a source that can send
73
+ (Telegram, MQTT) you reach out with `send`. Do not go looking in pine's home folder for what is
74
+ configured: `sources` tells you.
75
+
76
+ When your owner wants something done at a time ("every morning at seven", "remind me at five",
77
+ "in twenty minutes"), that is a schedule, not a source: call `add_schedule` with a name, the
78
+ task in your own words, and one of `cron`, `every`, `at` or `in`. When it is time you are woken
79
+ with the task. `schedules` lists what is scheduled, `remove_schedule` ends one.
80
+
81
+ When your owner wants you to remember how something is done ("make a skill for this"), call
82
+ `add_skill` with a name, a line on when to use it, and the steps. It is listed among your
83
+ skills from your next message on; `remove_skill` deletes it. A fact rather than a procedure
84
+ belongs into your `MEMORY.md` instead. `add_skill` is refused in a conversation that has read
85
+ outside content.
86
+
87
+ Schedules, skills, sources and servers follow the same rule: leave the scope out and it is for
88
+ the conversation you are in.
89
+
90
+ If you are the main agent and your owner asks for a new agent, call `create_agent` with an id,
91
+ one line on what it is for, and its instructions written to the agent itself ("You are ..."):
92
+ its job, what it should and should not do, how it reports. Your owner confirms it, and the agent
93
+ exists at once. For a device or service that no existing type of source can watch, the main
94
+ agent can also write a new source type and register it with `add_source_type`
95
+ ([references/sources.md](references/sources.md)); try the existing types first.
96
+
97
+ Things you can do yourself: work in your workspace, keep notes there, use the tools you have,
98
+ hand work to the agents listed in your prompt, and write shared state under your own keys.
99
+
100
+ ## Which file to read
101
+
102
+ | You want to | Read |
103
+ |---|---|
104
+ | See what an agent is given (events, schedules, MCP servers, skills) and how events, tasks and sessions fit together | [references/overview.md](references/overview.md) |
105
+ | Chat with agents in the terminal: tabs, slash commands, approvals, switching models | [references/tui.md](references/tui.md) |
106
+ | Work on a project: `pine .`, a folder for a conversation, the code pane with git changes, files and tool output | [references/coding.md](references/coding.md) |
107
+ | Install it, start it, use the CLI, run it at login, find out why something did not happen | [references/operations.md](references/operations.md) |
108
+ | Look up a key in `pine.json`, `agent.json`, `models.json` or `.env` | [references/configuration.md](references/configuration.md) |
109
+ | Know what agents can set up by tool call, for whom, and what you are asked: event sources, MCP servers, skills, schedules, new agents, new source types | [references/setup.md](references/setup.md) |
110
+ | Add an agent, give it a workspace, tools and a persona; skills; how agents look pine up (the `manual` tool); delegation, sub-agents, sessions, shared state | [references/agents.md](references/agents.md) |
111
+ | Let an agent react to the outside world and reach out: Telegram, a watched folder, MQTT devices, a web address or a command that is looked at again and again, webhooks, FTP uploads from cameras; subscribing, unsubscribing, sending; a source type of your own | [references/sources.md](references/sources.md) |
112
+ | Have something done at a time (schedules); write rules for events yourself: set state, publish, single model calls, debounce | [references/events.md](references/events.md) |
113
+ | Add MCP servers globally or per agent; web search, page reading and the bundled browser; turn shell commands into tools | [references/mcp.md](references/mcp.md) |
114
+ | Understand the defences against outside abuse and prompt injection, and their limits | [references/security.md](references/security.md) |
115
+ | Know the technology underneath and the pi behaviours pine works around; open points | [references/stack.md](references/stack.md) |
116
+ | Change pine's code | [../AGENTS.md](../AGENTS.md) |
117
+
118
+ ## The shortest working setup
119
+
120
+ ```bash
121
+ npm install -g @pmndrs/pine
122
+ ```
123
+
124
+ ```bash
125
+ pine init
126
+ ```
127
+
128
+ ```bash
129
+ pine
130
+ ```
131
+
132
+ One agent, `main`, with web search and a browser, and the terminal UI to talk to it. Everything
133
+ below is added on top of that when you need it.
134
+
135
+ `~/.pine/pine.json`:
136
+
137
+ ```json
138
+ {
139
+ "main": "main",
140
+ "defaults": { "model": "dev/claude-haiku" }
141
+ }
142
+ ```
143
+
144
+ (An excerpt. `pine init` also writes the web and browser servers and the limits; put the model
145
+ you use where `dev/claude-haiku` stands.)
146
+
147
+ Telegram as a second way in is set up by asking the main agent: "watch Telegram". The dialog
148
+ you confirm has a field for the bot's token; then you write to the bot and type the six-digit
149
+ code it sends you into pine. See [references/sources.md](references/sources.md).
150
+
151
+ `~/.pine/agents/gonzo/agent.json`, a second agent, a specialist the main agent can hand work to.
152
+ Create the folder; the workspace here is `~/dev/gonzo`, which must exist, and an `AGENTS.md` in
153
+ it says what the agent is for (without `workspace`, pine makes `agents/gonzo/workspace` itself).
154
+ Or ask the main agent to create one: it calls `create_agent`, and no restart is needed.
155
+
156
+ ```json
157
+ {
158
+ "description": "Contract law; knows the case files",
159
+ "workspace": "~/dev/gonzo"
160
+ }
161
+ ```
162
+
163
+ ```bash
164
+ pine check
165
+ ```
166
+
167
+ ```bash
168
+ pine start
169
+ ```
170
+
171
+ `main` sees `gonzo` in its list of agents and can call `delegate`. `pine events -f` shows everything as it happens.
172
+
173
+ ## Vocabulary
174
+
175
+ | Term | Meaning |
176
+ |---|---|
177
+ | event | One record in the log: topic, payload, source, trust, cause |
178
+ | topic | Slash-separated name, matched with `+` (one level) and `#` (the rest) |
179
+ | route | A rule in `pine.json` that reacts to topics |
180
+ | source | A named thing that reports events from outside: a folder, an MQTT broker, a web address, a command, a webhook, an FTP drop, a Telegram bot. It runs only while something is subscribed to it (or always, with `"start": "always"`) |
181
+ | schedule | Something done at a time: at set times, every so often, or once. With a task it wakes an agent to do it |
182
+ | subscription | A conversation of an agent listens to a source: each event arrives there as a message and wakes the agent |
183
+ | task | One piece of work for one agent; has a status, a result and statistics |
184
+ | session | A conversation of one agent with history. The manual also says "conversation". Named ones are kept until removed (unused ones after `limits.conversationDays`); `new` is one-off |
185
+ | owner | You. Content is "owner" only when it entered through a channel that authenticated you |
186
+ | untrusted | Everything else: data that may contain instructions it has no right to give |
187
+ | tainted | A session that has seen outside content (a web page, an MCP result, an untrusted task) |
188
+ | approval | Your yes or no to one tool call, asked in the terminal UI and over Telegram, or answered with `pine approve` |
189
+ | extension | A pi extension: pi's own plug-in format, usable in pine sessions |