Skip to main content

Durable workflow control for AI coding agents — inspectable, resumable, controllable multi-file work that survives context loss.

Project description

djobs

Durable workflow control for AI coding agents. When your AI agent runs a multi-file task, djobs makes every step inspectable, resumable, and controllable — and survives IDE crashes, context loss, or session interruptions.

CI PyPI License: MIT Python 3.11+

djobs demo — crash recovery in action


The Problem

AI coding agents (GitHub Copilot, Cursor, Cline, Claude Code) often run multi-file tasks: add docstrings to 40 files, migrate a framework version, batch-refactor an API. These can take minutes.

When the IDE crashes, the chat disconnects, or you accidentally close the window — all in-flight progress is lost. The agent's state lives only in chat history. You have to start over and guess which files were already done.

The Fix

djobs gives your agent three tools that solve this:

Tool What it does
enqueue_task Save each file as a durable task — survives any crash
complete_task Mark a file done after the agent edits it
resume_session On next chat, find all unfinished files instantly
You: "Add docstrings to all 20 files in src/"

  Agent calls enqueue_task for each file  ← checkpoint saved
  Agent edits file 1 → complete_task      ✅
  Agent edits file 2 → complete_task      ✅
  ...
  Agent edits file 12 → complete_task     ✅
  💥 VS Code crashes

You reopen VS Code, start a new chat: "hi"

  Agent calls resume_session              ← finds 8 incomplete tasks
  Agent edits file 13 → complete_task     ✅
  ...
  Agent edits file 20 → complete_task     ✅
  Done — zero files lost, zero files re-done.

Everything is stored in a local SQLite file. No Redis, no Docker, no cloud service.

How is this different from Celery / RQ / Dramatiq? Those are general-purpose task queues built for backend workers and high throughput. djobs is purpose-built for AI coding agents: it speaks MCP natively, optimizes for crash-recovery and human-inspectable audit trails over raw throughput, and runs with zero infrastructure — one local SQLite file, no broker, no daemon.

Maturity — early but tested. 291 passing tests, CI across Python 3.11–3.13, SQLite and optional PostgreSQL backends. Marked Alpha while the public API stabilizes; the core enqueue → complete → resume flow is stable and used daily.


Quick Start

djobs is a tool, not a project dependency. Install it once, globally — like git or ripgrep — and it works in every project, with or without a virtual environment. You do not add it to each project's requirements.txt or create a .venv for it.

pipx install djobs   # isolated global install (recommended)
djobs install-mcp    # wire it into the current project's VS Code agent

No pipx? pip install djobs works too (python -m pip install --user djobs for a user-level install). install-mcp auto-detects the right interpreter, so the wiring keeps working even in a JavaScript, Go, or Rust repo with no Python environment.

That's it — your AI agent now has crash-proof task memory.

Prefer the VS Code UI? Install the djobs extension and click Set up djobs when it offers — it runs the two steps above for you and adds a task sidebar.

Verify the setup at any time:

djobs doctor
# [OK  ] djobs package: v0.6.5 ...
# [OK  ] queue db (global default): ~/.djobs/global.db — exists, writable
# [OK  ] mcp.json wiring: command='djobs-mcp' — found
Options and manual setup
# Safe default (read-only tools auto-approved)
djobs install-mcp

# Or with full auto-approve (agent can enqueue/complete/fail without prompts)
djobs install-mcp --full-approve

Or add to .vscode/mcp.json manually. After a global install the djobs-mcp console script is on your PATH, so the wiring is identical on every OS:

{
  "servers": {
    "djobs": {
      "type": "stdio",
      "command": "djobs-mcp",
      "autoApprove": [
        "health", "resume_session", "check_task", "list_tasks", "audit_log"
      ]
    }
  }
}
Per-project venv (portable, for repos that commit mcp.json)

If you'd rather keep djobs inside each project's virtual environment — e.g. so a checked-in mcp.json resolves to whatever .venv each collaborator has — run djobs install-mcp --portable to emit a relocatable interpreter hint:

{
  "servers": {
    "djobs": {
      "type": "stdio",
      "command": "${workspaceFolder}/.venv/Scripts/python",
      "args": ["-m", "djobs.mcp_server"],
      "autoApprove": [
        "health", "resume_session", "check_task", "list_tasks", "audit_log"
      ]
    }
  }
}

On macOS / Linux the path is ${workspaceFolder}/.venv/bin/python. You can also pin any interpreter explicitly with djobs install-mcp --python /path/to/python.

Security note: The default autoApprove list only includes read-only tools. If you want your agent to enqueue/complete/fail tasks without confirmation prompts, add "enqueue_task", "complete_task", and "fail_task" to the array — but understand that this allows the agent to mutate queue state without asking.


Making Your Agent Use djobs Automatically

After installing, your agent has the MCP tools available — but it won't use them unless you tell it to. Add the following to your agent instructions (e.g. .github/copilot-instructions.md or any .agent.md):

At the start of every session, call resume_session to find unfinished work.
For multi-file tasks, enqueue each file as a durable task and call complete_task after each edit.

What this gives you:

  • On every new chat, unfinished work is automatically surfaced
  • For multi-file tasks (>3 files), each file is tracked as a durable task
  • After editing each file, progress is recorded
  • If a session crashes, the next chat auto-resumes from where it stopped — no questions asked

You can also use the djobs install-instructions CLI command to add the guidance block automatically.


See It In Action

The animated SVG above shows the full demo. To run it yourself:

pip install djobs
# if you cloned the repo:
python examples/run_migration_demo.py

20 files enqueued → 12 completed → crash → resume → 8 remaining finished. Zero data loss.


What Else Can It Do?

Beyond the three core tools, djobs also provides:

  • audit_log — "What did the AI do yesterday?" Full event history across sessions.
  • check_task / list_tasks — Inspect individual tasks or list by workspace.
  • health — Queue depth by status at a glance.
  • djobs doctor — One-shot setup check: confirms djobs is installed, the queue DB is writable, and .vscode/mcp.json is wired correctly. Run it (or "djobs: Diagnose Setup" in VS Code) whenever something feels off.
  • Multi-agent coordination — Several agents share one queue: claim_task (atomic, exclusive), heartbeat_task, release_task, task dependencies (depends_on), resource locks (resource_key), and an agent registry (register_agent / agent_heartbeat / list_agents).
  • Web dashboarddjobs dashboard serves a read-only, cross-agent view of queue health, every task, and the live agent fleet at http://127.0.0.1:8787 (stdlib only, no extra deps). Local-only by design: no authentication, binds to 127.0.0.1; for remote access use an SSH tunnel rather than exposing a public interface.
  • Retry with backoff — Failed tasks can retry automatically.
  • Dead letter queue — Tasks that exhaust all retries are preserved for review.

For the full architecture, Python library API, PostgreSQL backend, configuration reference, and comparison with other tools, see docs/INTERNALS.md.


Development

git clone https://github.com/jhuang-tw/djobs.git
cd djobs
python -m venv .venv && .venv/bin/activate
pip install -e ".[dev]"

pytest -q              # 291 tests (18 skipped without Postgres)
ruff check src/ tests/ # lint

See CONTRIBUTING.md for guidelines.


VS Code Extension

djobs includes a VS Code sidebar extension for visual workflow control:

  • Workflow dashboard — tasks grouped by workflow and action type with progress indicators
  • Resume from any step — expand a workflow, pick a file, and the previous steps are auto-accepted
  • Skip / Archive — mark tasks done without editing, or archive stale workflows
  • Evidence trail — see what the agent actually changed in each completed task

Install the VSIX from vscode-ext/ or build it yourself:

cd vscode-ext && npm install && npm run package
# Install: code --install-extension djobs-0.6.0.vsix

Roadmap

  • Durable workflow state (enqueuecompleteresume)
  • Audit trail — "what did the AI do?"
  • MCP server with 14 tools
  • pip install djobs && djobs install-mcp — two-command setup
  • Published on PyPI
  • complete_task evidence field — agent records what it changed
  • VS Code sidebar — workflow dashboard, resume from any step, skip/archive
  • CLI workflow control — djobs skip, djobs accept-before, djobs archive-workflow
  • Multi-agent coordination — shared-queue claim, dependencies, resource locks, agent registry
  • Web dashboard — djobs dashboard cross-agent global view
  • Published on VS Code Marketplace
  • Status bar badge + notification alerts

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

djobs-0.7.0.tar.gz (57.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

djobs-0.7.0-py3-none-any.whl (62.9 kB view details)

Uploaded Python 3

File details

Details for the file djobs-0.7.0.tar.gz.

File metadata

  • Download URL: djobs-0.7.0.tar.gz
  • Upload date:
  • Size: 57.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for djobs-0.7.0.tar.gz
Algorithm Hash digest
SHA256 c836e004e56ce8fcf8974cc9091ff480ea9e1e971cd0ad3473b27361bcdb7fa1
MD5 5361a433a1cd319e4c3435028732aa31
BLAKE2b-256 08c61c0a934e6ff171ee2358d6c75feb32a341f07cf5c6fcd103e043cf879b9a

See more details on using hashes here.

Provenance

The following attestation bundles were made for djobs-0.7.0.tar.gz:

Publisher: publish.yml on jhuang-tw/djobs

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file djobs-0.7.0-py3-none-any.whl.

File metadata

  • Download URL: djobs-0.7.0-py3-none-any.whl
  • Upload date:
  • Size: 62.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for djobs-0.7.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c1b2ce5855b84b5af82f99933e08a8e14381c3c15af42ac0c56d1654f409c05e
MD5 f59591868ede92bf96624ed806e386b3
BLAKE2b-256 58eb274b532ecd32f515296481deb53077cc004875e90b3334af287def8b8e9b

See more details on using hashes here.

Provenance

The following attestation bundles were made for djobs-0.7.0-py3-none-any.whl:

Publisher: publish.yml on jhuang-tw/djobs

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page