{"id":46236412,"url":"https://github.com/craftyc0der/coder_gan","last_synced_at":"2026-03-03T19:08:28.015Z","repository":{"id":339785450,"uuid":"1162877934","full_name":"craftyc0der/coder_gan","owner":"craftyc0der","description":"A Generative Adversarial Network inspired tool for code development. Multi-agent system where isolated coding agents compete and collaborate—each with restricted file access—ensuring they can't \"cheat\" by reading each other's work. A Rust orchestrator manages agent communication via message queues.","archived":false,"fork":false,"pushed_at":"2026-03-01T23:07:07.000Z","size":114,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2026-03-02T01:56:30.636Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/craftyc0der.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":"AGENTS.md","dco":null,"cla":null}},"created_at":"2026-02-20T20:07:25.000Z","updated_at":"2026-03-01T23:07:10.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/craftyc0der/coder_gan","commit_stats":null,"previous_names":["craftyc0der/coder_gan"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/craftyc0der/coder_gan","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/craftyc0der%2Fcoder_gan","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/craftyc0der%2Fcoder_gan/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/craftyc0der%2Fcoder_gan/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/craftyc0der%2Fcoder_gan/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/craftyc0der","download_url":"https://codeload.github.com/craftyc0der/coder_gan/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/craftyc0der%2Fcoder_gan/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30056056,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-03T18:21:05.932Z","status":"ssl_error","status_checked_at":"2026-03-03T18:20:59.341Z","response_time":61,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-03-03T19:08:27.446Z","updated_at":"2026-03-03T19:08:28.008Z","avatar_url":"https://github.com/craftyc0der.png","language":"Rust","funding_links":[],"categories":["Rust"],"sub_categories":[],"readme":"🤖 Coder GAN: Generative Adversarial Network for Software Development\n\nA multi-agent orchestration framework inspired by GANs. Like a generative adversarial network, competing agents drive quality:\n\n• Generator (Coder): Writes implementation code\n• Discriminator (Tester): Validates and challenges the implementation\n• Moderator (Reviewer): Resolves disputes and ensures quality\n\n🔒 Architectural Integrity: Each agent has restricted file system access—coders can't peek at tests, testers can't see implementation details before review. This prevents \"cheating\" and forces genuine problem-solving, mimicking real exam conditions where students can't see the answer key.\n\n🦀 Built with Rust: Generic orchestrator works with any project. Agents communicate via filesystem message queues and run in isolated tmux sessions.\n\nPerfect for: Autonomous coding experiments, multi-agent AI research, adversarial code quality systems.\n\n## Project Overview\n\n**coder_gan** is a generic multi-agent coding orchestration tool. A Rust orchestrator can be pointed at **any project directory**, launches and supervises configurable autonomous coding agents, enables agent-to-agent communication via filesystem message queues, and injects messages into live interactive terminal sessions using tmux.\n\nEach project defines its own agent roles, CLI commands, and startup prompts via a `.orchestrator/` configuration directory.\n\nSee `ai_implementation/step1_brainstorming.md` for the full PRD.\n\n## Repository Layout\n\n```\ncoder_gan/\n├── orchestrator/         # Rust orchestrator (the generic tool)\n│   ├── Cargo.toml\n│   └── src/\n│       ├── main.rs       # CLI entry point (init, spike, run, status, stop)\n│       ├── config.rs     # Project config loading, TOML parsing, path resolution\n│       ├── spike.rs      # tmux spike for de-risking injection\n│       ├── injector.rs   # tmux inject/capture with retry logic\n│       ├── logger.rs     # Structured JSON line event logger\n│       ├── supervisor.rs # Agent spawning, health loop, state persistence\n│       └── watcher.rs    # Filesystem message watcher with routing \u0026 dedup\n└── ai_implementation/    # Design docs and brainstorming\n```\n\n## Per-Project `.orchestrator/` Layout\n\nWhen you run `orchestrator init \u003cproject-path\u003e`, this is created inside the target project:\n\n```\n\u003cproject\u003e/\n├── .orchestrator/\n│   ├── agents.toml              # Agent definitions (editable)\n│   ├── prompts/\n│   │   ├── coder.md             # Startup prompt for coder agent\n│   │   ├── tester.md            # Startup prompt for tester agent\n│   │   └── reviewer.md          # Startup prompt for reviewer agent\n│   ├── messages/\n│   │   ├── to_coder/            # Inbox per agent (auto-derived from agents.toml)\n│   │   ├── to_tester/\n│   │   ├── to_reviewer/\n│   │   ├── processed/\n│   │   └── dead_letter/\n│   └── runtime/\n│       ├── logs/\n│       │   ├── events.jsonl\n│       │   ├── state.json\n│       │   └── spike_transcripts/\n│       └── pids/\n```\n\n## `agents.toml` Format\n\n```toml\n[[agents]]\nid = \"coder\"\ncommand = \"claude\"\nprompt_file = \"prompts/coder.md\"        # relative to .orchestrator/\nallowed_write_dirs = [\"orchestrator/src/\"]            # relative to project root\n\n[[agents]]\nid = \"tester\"\ncommand = \"codex\"\nprompt_file = \"prompts/tester.md\"\nallowed_write_dirs = [\"orchestrator/tests/\"]\n\n[[agents]]\nid = \"reviewer\"\ncommand = \"copilot\"\nprompt_file = \"prompts/reviewer.md\"\n```\n\n- **Tmux session names** are auto-derived: `{project-dir-name}-{agent-id}` (e.g., `myproject-coder`)\n- **Inbox directories** are auto-derived: `.orchestrator/messages/to_{agent_id}/`\n- **Prompt template variables**: `{{project_root}}`, `{{messages_dir}}`, `{{agent_id}}`\n\n## Rust Orchestrator Architecture\n\nThe orchestrator has 6 core modules in `orchestrator/src/`:\n\n1. **Config** (`config.rs`) — loads `agents.toml`, resolves all paths relative to `.orchestrator/`, renders prompt templates, scaffolds new projects via `init`\n2. **Process Supervisor** (`supervisor.rs`) — spawns agent tmux sessions, tracks restart counts, respawns crashed agents with exponential backoff (cap: 5 restarts in 2 minutes, then mark degraded)\n3. **Message Watcher** (`watcher.rs`) — uses `notify` crate to detect new files in `messages/to_*` directories, routes messages to agent sessions, SHA-256 dedup, backpressure handling\n4. **Injector** (`injector.rs`) — sends message content into tmux sessions via `tmux load-buffer` + `paste-buffer` + `send-keys Enter`; retry logic (3 attempts, 1s backoff). Also handles cross-platform terminal window launching (Terminal.app on macOS, various emulators on Linux).\n5. **Event Logger** (`logger.rs`) — appends structured JSON lines to `events.jsonl` for all spawn/exit/restart and message routing events\n6. **Spike** (`spike.rs`) — de-risking tool to validate tmux injection against any configured agent\n\n## Message Protocol\n\n- **File format**: `.md` or `.txt` (optionally `.json` envelope)\n- **Naming convention**: `2026-02-20T12-34-56Z__from-coder__to-tester__topic-tests.md`\n- **Atomic writes**: writers must write to a temp file then rename into the inbox\n- **Delivery**: at-least-once; deduplicate by content hash\n- **Lifecycle**: new file → inject → move to `processed/` on success, or `dead_letter/` after retries exhausted\n\n## OS \u0026 Terminal Support\n\nThe orchestrator supports cross-platform terminal window launching to visualize agent sessions:\n\n- **macOS**: Uses `Terminal.app` via AppleScript.\n- **Linux**: Automatically detects and launches the appropriate terminal emulator with no-fork flags. Supported emulators include:\n  - `ptyxis` (Fedora GNOME default)\n  - `gnome-terminal` (Ubuntu/GNOME)\n  - `konsole` (KDE)\n  - `xfce4-terminal` (XFCE)\n  - `alacritty`\n  - `kitty`\n  - `xterm`\n\n## Build Commands\n\n```bash\ncd orchestrator\ncargo build                                    # build orchestrator\ncargo run -- init /path/to/project             # scaffold .orchestrator/ in a project\ncargo run -- run /path/to/project              # launch all agents\ncargo run -- spike /path/to/project            # test injection (first agent)\ncargo run -- spike /path/to/project --agent tester  # test specific agent\ncargo run -- status /path/to/project           # check agent health\ncargo run -- stop /path/to/project             # clean shutdown\ncargo test                                     # run tests\n```\n\nAll path arguments default to `.` (current directory) if omitted.\n\n---\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcraftyc0der%2Fcoder_gan","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcraftyc0der%2Fcoder_gan","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcraftyc0der%2Fcoder_gan/lists"}