Skip to main content
Glama
README.md
# ziptask

[![CI](https://github.com/zumik3-del/ziptask/actions/workflows/ci.yml/badge.svg)](https://github.com/zumik3-del/ziptask/actions/workflows/ci.yml)
[![CodeQL](https://github.com/zumik3-del/ziptask/actions/workflows/codeql.yml/badge.svg)](https://github.com/zumik3-del/ziptask/actions/workflows/codeql.yml)
[![Security Audit](https://github.com/zumik3-del/ziptask/actions/workflows/security.yml/badge.svg)](https://github.com/zumik3-del/ziptask/actions/workflows/security.yml)
[![Coverage Status](https://coveralls.io/repos/github/zumik3-del/ziptask/badge.svg?branch=main)](https://coveralls.io/github/zumik3-del/ziptask?branch=main)
[![GitHub Release](https://img.shields.io/github/v/release/zumik3-del/ziptask?label=latest)](https://github.com/zumik3-del/ziptask/releases)
[![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)
[![Bun](https://img.shields.io/badge/bun-runtime-%23000000?logo=bun)](https://bun.sh)

MCP task tracker for AI agents — pure state layer (statuses, deps, leases, versioning) over SQLite.

![ziptask](assets/ziptask.png)

## Install

One-liner — installs the published binary via the `deploy/` framework (see
[`deploy/app.env`](deploy/app.env) for every knob), seeds a default
`settings.json` and provisions the service:

```bash
# latest release
curl -fsSL https://raw.githubusercontent.com/zumik3-del/ziptask/main/deploy/install.sh | bash

# from a checkout, or pinned to a version
sudo bash deploy/install.sh --version v0.8.0
```

Both forms need root for `/opt`, `/var/lib` and the unit: the piped form calls
`sudo` for each privileged step, so run it as a user who can sudo; the checkout
form is shown with `sudo`.

Canonical layout: binary in `/opt/ziptask`, database **and** `settings.json` in
`/var/lib/ziptask/`, deploy state (helpers, hooks, `app.env`) in `~/.ziptask/`.
`/opt/ziptask/data` is a symlink to `/var/lib/ziptask` that the installer
creates, because the shipped `dbPath` is relative.

`--port N` seeds a fresh `settings.json` with `port: N` and points the health
check at it (an existing file is never rewritten); `--dir D` moves the payload,
the config and the database under `D` (config at `D/data/settings.json`) while
the deploy state stays in `~/.ziptask/`; `--version` pins a release and
`--no-service` skips systemd — `bash deploy/install.sh --help` lists them all.
Both `--dir` and `--port` are also persisted into the installed
`~/.ziptask/scripts/app.env` (`INSTALL_DIR`, `DATA_DIR`, `EXEC_START`,
`CONFIG_FILE`, `PORT`) — the file `updater.sh` and `update.sh` reload — so later
updates keep using `D` and `N` instead of the canonical `/opt/ziptask` and
`3005`. A repeat install with the same flags rewrites nothing.

The deploy state is root-owned (`app.env` is `0640 root:<service-group>`,
directories and helper scripts `0750`), so the service account and the account
that runs the update must be in that group. Five files — `update.sh`,
`updater.sh`, `uninstall.sh`, `common.sh` and `app.env` — are installed into
`~/.ziptask/scripts/`. Every entry point — `install.sh`,
`update.sh`, `uninstall.sh` and `updater.sh` — screens `~/.ziptask`, `scripts/`,
`hooks/` and `scripts/app.env` and aborts before changing anything if one of them
is a symlink (dangling included): `cp`, `chown`, `chmod`, `source` and `bash` all
dereference, so a planted link would retarget the work at an arbitrary path.
Inspect the link, remove it, re-run.

The layout, the unit policy and the per-app `app.env` keys are shared with
synaptomind and subagentix and documented once, in
[zumik3-del/synaptomind `docs/DEPLOY-LAYOUT.md`](https://github.com/zumik3-del/synaptomind/blob/main/docs/DEPLOY-LAYOUT.md).
That document is the shared map; [`deploy/app.env`](deploy/app.env) stays the
source of truth for ziptask's own keys, and its ziptask column lags this repo on
`HEALTH_VERSION_FIELD`, `SERVICE_USER` and the `app.env` mode.

Prebuilt release binaries target Linux x86_64 only. On other platforms (macOS, arm64 Linux) build from source with `bun run build:bin`.

### Service mode

When systemd is detected and running, the installer renders
`/etc/systemd/system/ziptask.service` from the framework's unit template
(`Restart=always`, a bounded `TimeoutStopSec`, and the usual hardening) and
starts it. The unit runs as the invoking account — `SUDO_USER` when the install
went through `sudo` — unless `SERVICE_USER` in
[`deploy/app.env`](deploy/app.env) names another one: it wins over `SUDO_USER`,
and a name that does not exist on the host aborts the install before anything is
written. A shell that is root without `SUDO_USER` (a container, `su -`,
`docker exec -u root`) has no invoking account to inherit: the installer warns,
names `SERVICE_USER`, and continues with a root-run unit — set `SERVICE_USER`
(or install through `sudo` from that account) to keep the service unprivileged;
`SERVICE_USER=root` is the explicit way to say root is intended. Set it (plus
`SERVICE_GROUP` when the group is not the account's own) to run under a
dedicated account. Manage it with:

```bash
sudo systemctl start ziptask
sudo systemctl stop ziptask
sudo systemctl enable ziptask     # auto-start on boot
journalctl -u ziptask -f         # live logs
```

Remove with `bash ~/.ziptask/scripts/uninstall.sh`. It always removes the unit
and `~/.ziptask/scripts/`; the binary and the database stay unless you pass
`--purge`, and `~/.ziptask` itself is never deleted.

### Update

```bash
bash ~/.ziptask/scripts/updater.sh                    # newest stable release, interactive
bash ~/.ziptask/scripts/updater.sh --version v0.8.0   # pin a release
bash ~/.ziptask/scripts/update.sh --version v0.8.0    # direct, for a prerelease or an exact tag
```

An update stages the release, backs the database up and swaps the binary,
keeping the previous one as `ziptask.prev`. When the health check fails it
prints the exact rollback — move `.prev` back, restore the database — and
nothing is rolled back automatically. See
[Configuration](docs/configuration.md#upgrade-path).

### MCP client config (stdio)

```jsonc
// Claude Desktop / Cursor / opencode — see your client's MCP config (key "mcpServers" in most)
{
  "mcpServers": {
    "ziptask": {
      "command": "/opt/ziptask/ziptask",
      "args": ["--stdio", "--settings", "/var/lib/ziptask/settings.json"]
    }
  }
}
```

Pass `--settings` so the DB path and options come from `settings.json` regardless of the client's working directory — otherwise the DB defaults to `./data/ziptask.db` under the client's cwd. Clients do not expand `~` in `command`/`args`, so substitute the absolute path (`/var/lib/ziptask/settings.json` in the canonical layout). The installer seeds that file `0600` for the service account, so a stdio client running as another account needs read access to it — and write access to the database directory — or it cannot open the DB.

### MCP client config (remote HTTP)

When the service is running on the same host, point the client at the HTTP endpoint instead:

```jsonc
// opencode's MCP config shape ("mcp" + "type": "remote"); other clients call the
// key "mcpServers" and spell the remote transport in their own way
{
  "mcp": {
    "ziptask": { "type": "remote", "url": "http://127.0.0.1:3005/mcp" }
  }
}
```

The endpoint has no authentication, so keep it bound to `127.0.0.1` (`ZIPTASK_HOST`/`settings.json`). Use a reverse proxy with auth if it must be reachable from other hosts.

## Quick start (from source)

Requires [Bun](https://bun.sh) 1.4.2 — the version CI pins.

```bash
bun install
bun run start          # HTTP server on an ephemeral port (MCP endpoint + /health + experimental /api/tasks and /api/task/:id)
bun run start:stdio    # run over stdio
```

## Build a binary

```bash
bun run build:bin        # produces dist/ziptask
dist/ziptask --version   # prints ziptask and the package.json version
dist/ziptask --help      # lists the flags
dist/ziptask --stdio     # runs as stdio MCP server
```

## Architecture

Layered by carrier, no framework beyond the MCP SDK:

| Layer | Location | Responsibility |
|---|---|---|
| MCP | `src/mcp/` | Tool schemas, registration, response shaping |
| Service | `src/core/` | Domain rules: transitions, leases, deps, versioning |
| Storage | `src/db/` | SQL (bun:sqlite, WAL) + migrations |
| Entry | `src/index.ts`, `src/server.ts` | Composition root, HTTP transport |

The public task API is MCP, exposed at `POST`/`GET`/`DELETE` `/mcp`, alongside `GET /health` and two experimental REST-style read endpoints, `GET /api/tasks` and `GET /api/task/:id` (the latter kept as an integration endpoint for the subagentix client). No endpoint authenticates. Enumeration is scoped: the enumerating tools require a project slug, while by-id calls stay unscoped — see [Projects](docs/projects.md). See [HTTP endpoints](docs/http-endpoints.md).

## Development

```bash
bun run dev                # HTTP server under --watch
bun test                   # unit tests (per-test temp DBs)
bunx tsc --noEmit          # type check
bun run lint               # biome check src/ scripts/ (lint + format check)
bun run format             # biome format --write src/ scripts/
bun run check:boundaries   # mcp -> core -> db import direction (CI gate)
bun run src/smoke.ts       # MCP end-to-end over HTTP (ephemeral port + temp DB)
```

`CHANGELOG.md` is a short pointer to the current release, updated by hand at release time; the per-release notes are generated from the non-merge commits since the previous tag. There is no changelog script — `release.yml` creates the tag and the Release on `main`.

## Documentation

- [Configuration](docs/configuration.md) — `settings.json`, environment variables, the upgrade path, and backups.
- [HTTP endpoints](docs/http-endpoints.md) — `/mcp`, `/health`, and the two experimental read endpoints `GET /api/tasks` and `GET /api/task/:id`.
- [MCP tools](docs/mcp-tools.md) — the 14-tool reference, projects and scope, task statuses, lease-reap semantics, and lease recovery paths.
- [Projects](docs/projects.md) — what a project is, the slug, the fail-closed scope rule, and the four project tools.
- [Epic → sub-task workflow](docs/epics.md) — declaring epics, attaching sub-tasks, roll-up, closure, and the cross-project constraints.
- [Subagent setup](docs/subagents.md) — install and configure the example orchestrator + subagent agents.

## License

MIT

Please note that this project is released with a [Contributor Code of Conduct](CODE_OF_CONDUCT.md). By participating in this project you agree to abide by its terms.