Open source · Go · AI agents

Madar مدار

An autonomous coding agent: a Go binary that runs on your server, polls GitHub Issues for tasks, and executes them end-to-end using Claude Code: committing code, opening PRs, watching CI, and looping back when tests fail.

← Back to projects

Overview

What is Madar?

Madar is an autonomous software engineering agent written in Go. It bridges GitHub Issues and Claude Code CLI: you describe a task in a GitHub Issue, apply the ready label, and Madar does the rest: coding, testing, committing, PR creation, and CI monitoring, all without human interaction.

GoClaude CodeGitHub APISQLiteTelegramSystemd

Workflow

How it works

1
Write the task

Open a GitHub Issue with a clear description and apply the ready label.

2
Madar picks it up

The agent polls every 15–60 seconds, claims the issue, transitions it to in-progress, and spawns a Claude Code session inside a local clone of the repo.

3
Claude executes

Claude Code edits files, runs shell commands, commits changes, creates a branch, and opens a PR, all autonomously.

4
CI feedback loop

Madar watches GitHub Actions. If CI fails, it re-invokes Claude with the failure output, up to a configured retry limit.

5
Done or escalate

On success, the issue is marked done and you get a Telegram notification. If clarification is needed, Madar posts a question and waits for your GitHub reply.

GitHub Issue (ready) │ ▼ Madar polls → claims issue → in-progress │ ▼ Claude Code runs (edits files, commits, opens PR) │ ┌───┴──────────────┐ │ │ CI green CI red (retries left) │ │ ▼ ▼ label: done resume Claude with failure output Telegram ✅ │ retries > max → awaiting-feedback Telegram 🤔 → you reply on GitHub │ Madar resumes

Features

Key capabilities

Claude Code integration

Wraps the Claude Code CLI in headless stream-json mode. Each task maps to a persistent session UUID, resumable after crashes or human replies.

GitHub Issues as a board

No custom UI. State is expressed as labels: readyin-progressdone. Search, filter, and assign natively in GitHub.

CI/CD feedback loop

Polls GitHub Actions after each PR. Automatically re-invokes Claude with test failure output until green or a retry cap is reached.

Telegram notifications

Instant alerts when tasks complete or Claude needs input. Reply on GitHub; Madar detects your comment and resumes the session.

SQLite state machine

Persists task-to-session mapping, CI retry counters, and an audit log. Survives process restarts with zero operational overhead.

One-command install

An idempotent shell installer sets up dependencies, authenticates Claude, configures the agent interactively, and installs a systemd service.

Design

Design decisions

Supervise, don’t reimplement

Madar wraps the claude CLI rather than reimplementing agentic behavior. Claude Code already handles file edits, shell execution, and session memory; Madar provides the loop, board integration, and lifecycle management.

Polling over webhooks

Polling requires no inbound networking: the server needs no open ports. For a single-operator setup, 15–60 second latency is acceptable and keeps the deployment simple.

Single-threaded by default

One active task at a time. The concurrency guard uses GitHub labels as a distributed lock, so there are no race conditions by design. Parallel execution is a config switch away.

Session IDs pre-assigned

UUIDs are minted at claim-time before Claude launches. The task-to-session link exists in SQLite even if the process crashes mid-run, enabling safe resumption.

Quick start

Get running in minutes

One command installs everything: Node.js, gh CLI, Claude Code, the Madar binary, and a systemd service, with interactive prompts for your tokens.

curl -fsSL https://raw.githubusercontent.com/eslam-mahmoud/go-ai-agent/main/install.sh | bash
View full docs on GitHub