Skip to content

Repository files navigation

PACT - Protocol for Agent Communication & Tasks

Multi-agent collaboration tool that runs on your local Ollama instance. Point it at a problem, pick how many agents you want, and let them hash it out.

Written in C. No dependencies beyond Ollama and a C compiler.

what it does

You give it a task (or a file to look at) and a mode. It spins up 2-8 agents internally, each backed by whatever Ollama model you have pulled. They take turns reasoning about the problem — debating, reviewing code, brainstorming ideas, or analyzing files — until they reach a conclusion.

Everything runs in one process. No servers, no config files, no package managers.

build

gcc -o pact pact.c pact_json.c pact_ollama.c pact_protocol.c -lws2_32 -Wall

You need:

  • GCC (MinGW on Windows)
  • Ollama running locally with at least one model pulled (ollama pull gemma3)

usage

pact [options]

  --model <name>    which ollama model to use (default: gemma3)
  --mode <mode>     debate | code-review | brainstorm | analyze
  --task <prompt>   what the agents should work on
  --file <path>     feed a source file as context
  --agents <n>      number of agents, 2-8 (default: 2)
  --turns <n>       max rounds before stopping (default: 10)
  -v                show full conversation
  -nv               shut up, just give me the result

examples

Have two agents argue about something:

pact --task "is garbage collection worth the tradeoff in systems programming"

Review a file with 3 agents, full output:

pact --mode code-review --file main.c --agents 3 -v

Quiet brainstorm — just the ranked ideas at the end:

pact --mode brainstorm --task "ways to reduce API latency" -nv

Analyze code for issues using a different model:

pact --mode analyze --file parser.c --model deepseek-coder-v2

modes

mode what happens
debate agents argue opposing sides, poke holes in each other's logic
code-review agents review code — flag bugs, security issues, perf problems
brainstorm rapid idea generation, then ranking
analyze systematic deep-dive into a file or topic

output

Results get saved to .pact/output/ automatically:

  • <id>_transcript.md — full back-and-forth
  • <id>_result.md — final conclusion

how it works

There's no magic. The tool creates N "agents" (really just N different system prompts), then loops through them round-robin. Each agent gets the full conversation history with proper role mapping (its own messages as assistant, everyone else's as user), calls Ollama, and appends the response. Repeat until someone says [DONE] or you hit the turn limit.

The protocol layer (pact_protocol.c) handles task state on the filesystem. The JSON layer (pact_json.c) is hand-rolled — no external libs. The Ollama client (pact_ollama.c) is raw TCP sockets talking HTTP.

file structure

pact.c              — main binary, CLI, agent loop
pact_types.h        — structs and constants
pact_protocol.h/c   — task management, filesystem ops
pact_json.h/c       — json serialization (no deps)
pact_ollama.h/c     — ollama http client (raw sockets)

license

Do whatever you want with it.

About

PACT — Protocol for Agent Communication & Tasks

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages