Abd0r/porcupineai

Porcupine: A Safe Autonomous AI Agent

TypeScript

3

177 commits

updated Sep 17, 2026

See the code
agentic-ai
ai-agent
ai-assistant
ai-safety
automation
autonomous-agent
cli
computer-use
developer-tools
llm
mcp
model-context-protocol
multi-agent
nodejs
open-source-ai
safe-autonomy
terminal
terminal-ai
tui
typescript

README

Porcupine

CI npm version npm downloads MIT License GitHub stars

The open-source terminal AI agent built for safe autonomy.

Give Porcupine a goal. It reasons, routes capabilities, uses tools, delegates work, verifies the result, and keeps risky action inside the permission boundary you control.

Get started · Why Porcupine · Capabilities · Evaluation · Safety · Documentation

Built on top of Pi (MIT).


Why Porcupine

Porcupine does not treat autonomy as all-or-nothing. You choose how much it may do before asking.

Porcupine
Safe autonomyAsk, Normal, and Auto modes let you choose the permission boundary. Normal asks on flagged actions; Auto applies a fail-closed safety gate. Hardline destructive actions remain blocked.
End-to-end workPorcupine reads the real project, chooses tools and skills, edits files, runs checks, recovers from failures, and reports evidence instead of stopping at a plausible answer.
Native-firstIt works on your computer with your tools and files by default. Gondolin, Docker, and OpenShell isolation remain opt-in when you want a stronger boundary.
Parallel executionContext-isolated sub-agents can research, inspect, implement, and review in parallel. Web of Thoughts lets them coordinate live.
One session, more surfacesContinue the same attended session from the terminal, Telegram, Discord, or iMessage. Use headless and server modes for scripts, CI, IDEs, and clients.
Open capability systemTools and skills live in 18 capability stacks. Extend Porcupine through Agent Skills, MCP, TypeScript extensions, packages, prompts, themes, and custom providers.

Start in 60 seconds

Requires Node.js 22.19+.

npm install -g @porcupineai/porcupineai
porcupine

Then connect a provider inside the TUI:

/login cline
/model
/guide

Cline provides a free API route. Select cline/deepseek/deepseek-v4-flash from /model, or connect another supported provider with /login.

Give it a real goal:

Review this repository, explain how it works, run its checks, and make the safest high-impact improvement you can verify.

Porcupine decides whether the turn needs a direct answer, tools, a skill, a plan, or parallel workers. It continues until the requested result is real or a genuine decision requires you.

Build from source
git clone https://github.com/Abd0r/porcupineai.git
cd porcupineai/Porcupine
npm install --ignore-scripts
npm run build
npm link

How work flows

flowchart LR
    G[Your goal] --> R[Reason and route]
    R --> B{Permission and safety boundaries}
    B --> T[Tools and skills]
    B --> A[Parallel sub-agents]
    T --> V[Tests and verification]
    A --> V
    V --> E[Evidence-backed result]

The model leads the work. The harness supplies the capability tree, permission boundary, durable state, recovery paths, and verification loop.

Choose the autonomy level

ModeBehaviorBest for
AskConfirms every shell command and file mutationUnfamiliar repositories and maximum oversight
NormalRuns safe operations and asks on flagged actionsEveryday interactive work
AutoWorks autonomously while flagged shell actions pass through a fail-closed safety gateLonger goals in trusted projects

Reasoning depth is separate from permission. /reasoning and /adaptive change thinking effort; /modes changes what Porcupine may do without asking.

Auto is not unrestricted. Hardline destructive actions remain blocked in every mode.

What it can do

FacultyCapabilities
Build and maintainRead and edit repositories, run shell commands, debug failures, use Git, build, test, review, and document changes.
Develop for the webFrontend and backend workflows, accessibility, responsive design, APIs, authentication, migrations, observability, browser QA, performance, SEO, and deployment readiness.
ResearchFree web-search cascade, page extraction, Reddit and arXiv search, evidence grading, durable literature tracking, and parallel deep research.
Use the web and computerPlaywright browser tools, semantic snapshots, screenshots, responsive checks, diagnostics, and confirmation-gated native desktop interaction.
CoordinateUp to three parallel sub-agents by default, fresh context windows, hard step budgets, live progress, instant reports, steering, cancellation, and WoT peer messaging.
Remember and continueDurable sessions, branching, compaction, memory, reusable project workspaces, and cross-session history search.
Automate attended workDurable tasks, success and failure chains, file and script triggers, and UTC Cron schedules while the interactive session is open and idle.
CommunicateTelegram, Discord, and iMessage bridges; email over IMAP/SMTP; free X search and reading; local drafts and compose-then-paste posting.
IntegrateMCP tools, resources and prompts; porcupine serve; JSONL and RPC modes; a Node.js SDK; custom tools and providers.
ObservePer-turn usage, cost estimates, session evidence, task history, browser diagnostics, sub-agent activity, and a full-screen Markdown viewer.

Parallel work without losing the thread

Porcupine can delegate self-contained work to background sub-agents. Each worker receives:

  • a fresh context window;
  • the whole tool stack minus agent-level tools, user questions, and native computer control;
  • a hard step budget, 120 by default;
  • the same working directory and permission policy;
  • instant report injection when the worker finishes.

Give workers the same peerGroup to enable Web of Thoughts. They can exchange findings live while the main agent remains the gatekeeper. The main agent can steer a worker with send_to_subagent or stop it when it goes off track.

See Sub-agents.

One agent, more than one surface

SurfaceUse
Terminal TUIThe full interactive experience, including permission dialogs, session tree, Markdown viewer, usage, cost, and live activity.
Telegram, Discord, iMessageMessage the same attended session from another device. Chat/channel and sender allowlists protect prompts and approvals; valid confirmation buttons and reactions race the TUI.
HTTP serverporcupine serve exposes sessions, asynchronous prompts, SSE events, and programmatic approval for IDEs and clients.
Headless modeporcupine --headless "task" runs a CI-friendly task and exits 0 on success or 1 on failure or abort.
RPC and JSONLEmbed Porcupine in scripts and applications through structured process protocols.

Remote bridges are conversation-and-sender allowlist-gated and attended. They drive the shared session; they are not unattended daemons.

Extensible by design

Extension pointWhat it adds
StacksOne discoverable hierarchy for filesystem, shell, web, web development, VCS, build, debugging, safety, data, ML, research, computer use, and orchestration capabilities.
Agent SkillsOn-demand procedures in portable SKILL.md packages. Porcupine can extract skills from documents or craft them from research.
MCPConnect stdio and Streamable HTTP servers. Their tools, resources, and prompts become first-class capabilities.
TypeScript extensionsAdd tools, commands, event handlers, UI, providers, and lifecycle behavior.
PackagesBundle and share extensions, skills, prompts, and themes.
SDK and protocolsEmbed the agent loop through the Node.js SDK, RPC, JSONL, or the HTTP server.

Explore the 18-stack capability tree, skills, MCP, and extensions.

Providers

Porcupine separates the agent from the model route. Use a free path, a subscription, your own API key, or a local router.

RouteSetup
Cline APICreate a free key at app.cline.bot, run /login cline, then choose cline/deepseek/deepseek-v4-flash from /model.
OpenCode GoRun /login opencode-go, then choose an available model and reasoning level from /model.
Built-in providersConnect supported API-key and subscription providers with /login or provider environment variables.
Local modelsRoute supported local models through llama.cpp.

See Providers and llama.cpp.

Evaluation

Porcupine publishes its harness results with methodology, raw records, failures, and caveats.

SuitePorcupine resultEvidence
Aider Polyglot194/225, 86.2%Six languages, hidden tests restored after the agent run. Methodology and raw results.
Terminal-Bench 2.145 clean passes45/54 cleanly scored tasks passed; 35 of 89 tasks remained unscored after benchmark-rig failures. Scoring and raw results.

Both runs used DeepSeek V4 Flash through the Porcupine harness. These results measure the exact model and harness combination, not every model, provider, workload, or commercial agent.

Safety boundaries

Porcupine is native-first. By default, it runs with the permissions of the account that launches it.

  • Project trust is not a sandbox. It controls project-local resource loading, not operating-system permissions.
  • Interaction modes are the autonomy dial. Ask, Normal, and Auto control approvals; reasoning settings do not grant permission.
  • Auto fails closed on flagged shell actions. Hardline destructive actions remain blocked in every mode.
  • Native computer input is confirmation-gated. The workflow starts with observation, treats screen text as untrusted, takes one approved action, then verifies the visible result.
  • Isolation is optional. /sandbox on routes built-in tools into a Gondolin micro-VM. Docker and OpenShell workflows are also documented.
  • Extensions and skills are trusted code and instructions. Review them before loading them, and use trusted repositories.

Read Security and Containerization before using Porcupine on untrusted work.

Documentation

Contributing

Contributions are welcome. Keep changes focused, test behavior changes, and update documentation when the user-facing contract moves.

License and foundation

Porcupine is released under the MIT License.

Built on top of Pi (MIT).


If Porcupine helps you do real work, a GitHub star helps more people find it.

GitHub · npm · Releases · MIT License

Follow on X

Contributors

Abd0r

177 commits

Abd0r/porcupineai

Porcupine: A Safe Autonomous AI Agent

TypeScript

3

177 commits

updated Sep 17, 2026

See the code
agentic-ai
ai-agent
ai-assistant
ai-safety
automation
autonomous-agent
cli
computer-use
developer-tools
llm
mcp
model-context-protocol
multi-agent
nodejs
open-source-ai
safe-autonomy
terminal
terminal-ai
tui
typescript

README

Porcupine

CI npm version npm downloads MIT License GitHub stars

The open-source terminal AI agent built for safe autonomy.

Give Porcupine a goal. It reasons, routes capabilities, uses tools, delegates work, verifies the result, and keeps risky action inside the permission boundary you control.

Get started · Why Porcupine · Capabilities · Evaluation · Safety · Documentation

Built on top of Pi (MIT).


Why Porcupine

Porcupine does not treat autonomy as all-or-nothing. You choose how much it may do before asking.

Porcupine
Safe autonomyAsk, Normal, and Auto modes let you choose the permission boundary. Normal asks on flagged actions; Auto applies a fail-closed safety gate. Hardline destructive actions remain blocked.
End-to-end workPorcupine reads the real project, chooses tools and skills, edits files, runs checks, recovers from failures, and reports evidence instead of stopping at a plausible answer.
Native-firstIt works on your computer with your tools and files by default. Gondolin, Docker, and OpenShell isolation remain opt-in when you want a stronger boundary.
Parallel executionContext-isolated sub-agents can research, inspect, implement, and review in parallel. Web of Thoughts lets them coordinate live.
One session, more surfacesContinue the same attended session from the terminal, Telegram, Discord, or iMessage. Use headless and server modes for scripts, CI, IDEs, and clients.
Open capability systemTools and skills live in 18 capability stacks. Extend Porcupine through Agent Skills, MCP, TypeScript extensions, packages, prompts, themes, and custom providers.

Start in 60 seconds

Requires Node.js 22.19+.

npm install -g @porcupineai/porcupineai
porcupine

Then connect a provider inside the TUI:

/login cline
/model
/guide

Cline provides a free API route. Select cline/deepseek/deepseek-v4-flash from /model, or connect another supported provider with /login.

Give it a real goal:

Review this repository, explain how it works, run its checks, and make the safest high-impact improvement you can verify.

Porcupine decides whether the turn needs a direct answer, tools, a skill, a plan, or parallel workers. It continues until the requested result is real or a genuine decision requires you.

Build from source
git clone https://github.com/Abd0r/porcupineai.git
cd porcupineai/Porcupine
npm install --ignore-scripts
npm run build
npm link

How work flows

flowchart LR
    G[Your goal] --> R[Reason and route]
    R --> B{Permission and safety boundaries}
    B --> T[Tools and skills]
    B --> A[Parallel sub-agents]
    T --> V[Tests and verification]
    A --> V
    V --> E[Evidence-backed result]

The model leads the work. The harness supplies the capability tree, permission boundary, durable state, recovery paths, and verification loop.

Choose the autonomy level

ModeBehaviorBest for
AskConfirms every shell command and file mutationUnfamiliar repositories and maximum oversight
NormalRuns safe operations and asks on flagged actionsEveryday interactive work
AutoWorks autonomously while flagged shell actions pass through a fail-closed safety gateLonger goals in trusted projects

Reasoning depth is separate from permission. /reasoning and /adaptive change thinking effort; /modes changes what Porcupine may do without asking.

Auto is not unrestricted. Hardline destructive actions remain blocked in every mode.

What it can do

FacultyCapabilities
Build and maintainRead and edit repositories, run shell commands, debug failures, use Git, build, test, review, and document changes.
Develop for the webFrontend and backend workflows, accessibility, responsive design, APIs, authentication, migrations, observability, browser QA, performance, SEO, and deployment readiness.
ResearchFree web-search cascade, page extraction, Reddit and arXiv search, evidence grading, durable literature tracking, and parallel deep research.
Use the web and computerPlaywright browser tools, semantic snapshots, screenshots, responsive checks, diagnostics, and confirmation-gated native desktop interaction.
CoordinateUp to three parallel sub-agents by default, fresh context windows, hard step budgets, live progress, instant reports, steering, cancellation, and WoT peer messaging.
Remember and continueDurable sessions, branching, compaction, memory, reusable project workspaces, and cross-session history search.
Automate attended workDurable tasks, success and failure chains, file and script triggers, and UTC Cron schedules while the interactive session is open and idle.
CommunicateTelegram, Discord, and iMessage bridges; email over IMAP/SMTP; free X search and reading; local drafts and compose-then-paste posting.
IntegrateMCP tools, resources and prompts; porcupine serve; JSONL and RPC modes; a Node.js SDK; custom tools and providers.
ObservePer-turn usage, cost estimates, session evidence, task history, browser diagnostics, sub-agent activity, and a full-screen Markdown viewer.

Parallel work without losing the thread

Porcupine can delegate self-contained work to background sub-agents. Each worker receives:

  • a fresh context window;
  • the whole tool stack minus agent-level tools, user questions, and native computer control;
  • a hard step budget, 120 by default;
  • the same working directory and permission policy;
  • instant report injection when the worker finishes.

Give workers the same peerGroup to enable Web of Thoughts. They can exchange findings live while the main agent remains the gatekeeper. The main agent can steer a worker with send_to_subagent or stop it when it goes off track.

See Sub-agents.

One agent, more than one surface

SurfaceUse
Terminal TUIThe full interactive experience, including permission dialogs, session tree, Markdown viewer, usage, cost, and live activity.
Telegram, Discord, iMessageMessage the same attended session from another device. Chat/channel and sender allowlists protect prompts and approvals; valid confirmation buttons and reactions race the TUI.
HTTP serverporcupine serve exposes sessions, asynchronous prompts, SSE events, and programmatic approval for IDEs and clients.
Headless modeporcupine --headless "task" runs a CI-friendly task and exits 0 on success or 1 on failure or abort.
RPC and JSONLEmbed Porcupine in scripts and applications through structured process protocols.

Remote bridges are conversation-and-sender allowlist-gated and attended. They drive the shared session; they are not unattended daemons.

Extensible by design

Extension pointWhat it adds
StacksOne discoverable hierarchy for filesystem, shell, web, web development, VCS, build, debugging, safety, data, ML, research, computer use, and orchestration capabilities.
Agent SkillsOn-demand procedures in portable SKILL.md packages. Porcupine can extract skills from documents or craft them from research.
MCPConnect stdio and Streamable HTTP servers. Their tools, resources, and prompts become first-class capabilities.
TypeScript extensionsAdd tools, commands, event handlers, UI, providers, and lifecycle behavior.
PackagesBundle and share extensions, skills, prompts, and themes.
SDK and protocolsEmbed the agent loop through the Node.js SDK, RPC, JSONL, or the HTTP server.

Explore the 18-stack capability tree, skills, MCP, and extensions.

Providers

Porcupine separates the agent from the model route. Use a free path, a subscription, your own API key, or a local router.

RouteSetup
Cline APICreate a free key at app.cline.bot, run /login cline, then choose cline/deepseek/deepseek-v4-flash from /model.
OpenCode GoRun /login opencode-go, then choose an available model and reasoning level from /model.
Built-in providersConnect supported API-key and subscription providers with /login or provider environment variables.
Local modelsRoute supported local models through llama.cpp.

See Providers and llama.cpp.

Evaluation

Porcupine publishes its harness results with methodology, raw records, failures, and caveats.

SuitePorcupine resultEvidence
Aider Polyglot194/225, 86.2%Six languages, hidden tests restored after the agent run. Methodology and raw results.
Terminal-Bench 2.145 clean passes45/54 cleanly scored tasks passed; 35 of 89 tasks remained unscored after benchmark-rig failures. Scoring and raw results.

Both runs used DeepSeek V4 Flash through the Porcupine harness. These results measure the exact model and harness combination, not every model, provider, workload, or commercial agent.

Safety boundaries

Porcupine is native-first. By default, it runs with the permissions of the account that launches it.

  • Project trust is not a sandbox. It controls project-local resource loading, not operating-system permissions.
  • Interaction modes are the autonomy dial. Ask, Normal, and Auto control approvals; reasoning settings do not grant permission.
  • Auto fails closed on flagged shell actions. Hardline destructive actions remain blocked in every mode.
  • Native computer input is confirmation-gated. The workflow starts with observation, treats screen text as untrusted, takes one approved action, then verifies the visible result.
  • Isolation is optional. /sandbox on routes built-in tools into a Gondolin micro-VM. Docker and OpenShell workflows are also documented.
  • Extensions and skills are trusted code and instructions. Review them before loading them, and use trusted repositories.

Read Security and Containerization before using Porcupine on untrusted work.

Documentation

Contributing

Contributions are welcome. Keep changes focused, test behavior changes, and update documentation when the user-facing contract moves.

License and foundation

Porcupine is released under the MIT License.

Built on top of Pi (MIT).


If Porcupine helps you do real work, a GitHub star helps more people find it.

GitHub · npm · Releases · MIT License

Follow on X

Contributors

Abd0r

177 commits

Languages

TypeScript

95.4%

JavaScript

2.7%