Sign In

@spfunctions/harness

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@spfunctions/harness

Dual pi-agent runtime harness. Two agents (local + Cloudflare) negotiate, share state, and self-modify via a 5-message protocol.

latest
Source
npmnpm
Version
0.1.0
Version published
Weekly downloads
2
Maintainers
1
Weekly downloads
 
Created
Source

@spfunctions/harness

Dual pi-agent runtime harness. Two agents (local + Cloudflare) negotiate, share state, and self-modify via a 5-message protocol. Open source. $1–2/day to run.

npm i -g @spfunctions/harness

After install, the binary is sparkco.

Quick Start

sparkco init

The setup wizard will:

  • Check your environment (git, node, wrangler)
  • Configure Cloudflare credentials
  • Deploy the server runtime
  • Configure LLM models for both agents
  • Optionally install pi/Claude Code skill

Prerequisites

  • Node.js >= 18
  • git
  • wrangler (npm install -g wrangler)
  • pi (optional) (npm install -g @anthropic-ai/claude-code)

Cloudflare Setup

You need a Cloudflare API Token with these permissions:

PermissionLevelWhy
Workers ScriptsEditDeploy/update Workers
Workers KV StorageEditCreate/read/write KV
Workers RoutesEditConfigure routing
Durable ObjectsEditCreate DO namespace
Account SettingsReadVerify account

Create your token:

  • Go to https://dash.cloudflare.com/profile/api-tokens
  • Click "Create Token"
  • Choose "Create Custom Token"
  • Add the permissions listed above
  • Zone Resources: All zones (or specific zone)
  • Click "Continue to summary" then "Create Token"
  • Copy the token — you'll need it during sparkco init

Agent Model Configuration

SparkCo Harness runs two pi-agent runtimes that need LLM access to autonomously write code and modify environments.

During Setup

The setup wizard will ask you to configure an LLM provider. Recommended: OpenRouter — one key accesses all models.

Default model: minimax/minimax-m2.7 ($0.30/$1.20 per M tokens). Best cost-performance ratio for continuous agent operation.

Environment Variables (non-interactive mode)

VariableRequiredDefault
SPARKCO_LLM_PROVIDERNoopenrouter
SPARKCO_LLM_API_KEYYes
SPARKCO_CLIENT_MODELNominimax/minimax-m2.7
SPARKCO_SERVER_MODELNoSame as client

After Setup

sparkco model              # View current config
sparkco model test         # Verify both agents can respond
sparkco model set both anthropic/claude-sonnet-4-6  # Switch models
sparkco model key set <new-key>                      # Update API key

Costs

At default settings (MiniMax M2.7), continuous operation costs roughly $1-2/day depending on activity level. This covers both client and server pi runtimes.

Commands

CommandDescription
sparkco initInteractive setup wizard
sparkco statusSystem overview
sparkco daemon start|stop|restartManage client daemon
sparkco send <type> <content>Send protocol message
sparkco inboxView pending requests
sparkco routes list|add|removeManage local endpoints
sparkco psProcess management
sparkco manifest show|history|rollbackVersion control
sparkco logs [name]View logs
sparkco deployDeploy/redeploy server
sparkco secret set|list|deleteManage secrets
sparkco model show|set|list|key|testManage LLM models
sparkco server status|logs|tasksServer runtime management
sparkco improve status|issues|fixes|pause|resumeSelf-improvement engine
sparkco destroyTear down everything

All commands support --json for machine-readable output (useful for pi).

Architecture

CLIENT (local)              CLOUDFLARE            SERVER (VPS)
+--------------+     +------------------+     +--------------+
| pi-agent     |     | Worker (relay)   |     | pi-agent     |
| daemon       |<SSE>| ├─ auth         |<SSE>| daemon       |
| read/write   | REST| ├─ SSE relay    | REST| read/write   |
| npm/git      |---->| └─ KV/R2 proxy  |<----| npm/git      |
+--------------+     | Durable Object   |     | scheduler    |
                     | └─ event log     |     +--------------+
                     +------------------+

The communication protocol has 5 message types:

  • capability-request — "I need you to have X capability"
  • capability-ready — "X is ready at endpoint Y"
  • data — Payload on an established channel
  • state-sync — Heartbeat + version + process status
  • negotiate — Free-form discussion about capabilities

Pi Integration

After init, install the sparkco skill:

# For pi
cp src/pi/skill.md ~/.pi/agent/skills/sparkco/SKILL.md

# For Claude Code
cp src/pi/skill.md ~/.claude/skills/sparkco/SKILL.md

Or let the setup wizard handle it automatically.

Pi can then use all sparkco commands via bash to coordinate client-server workflows autonomously.

Configuration

Config lives at ~/.sparkco/config.json. See sparkco status for current values.

Development

npm install
npm test                    # all tests
npm run test:unit           # unit tests only
npm run test:integration    # integration tests only
npx tsx scripts/dev.ts      # local dev server + daemon

Uninstall

sparkco destroy
npm uninstall -g @spfunctions/harness

License

Apache-2.0

Keywords

agent

FAQs

Package last updated on 07 Apr 2026

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts