能力标签
⚙️
Agent工作流

开源AI工作流

基于 TypeScript · 无代码搭建完整 AI 自动化流程
英文名:agentcastle
⭐ 7 Stars 🍴 1 Forks 💻 TypeScript 📄 MIT 🏷 AI 7.5分
7.5AI 综合评分
workflowtypescript
✦ AI Skill Hub 推荐

AI Skill Hub 推荐使用:开源AI工作流 是一款优质的Agent工作流。AI 综合评分 7.5 分,在同类工具中表现稳健。如果你正在寻找可靠的Agent工作流解决方案,这是一个值得深入了解的选择。

📚 深度解析
开源AI工作流 是一套完整的 AI Agent 自动化工作流方案。随着 AI 能力的不断提升,基于 Agent 的自动化工作流正在成为提升个人和团队效率的核心方式。区别于传统的 RPA 自动化(模拟鼠标键盘操作),AI Agent 工作流通过理解任务意图、动态规划执行路径,能够处理更复杂的非结构化任务。

开源AI工作流 工作流的设计遵循"最小配置,最大复用"原则:核心逻辑已经封装好,用户只需配置自己的 API Key 和业务参数即可快速上手。工作流内置错误处理和重试机制,在网络波动或 API 限速等情况下仍能稳定运行,适合作为生产环境的自动化基础设施。

在实际部署时,建议先在测试环境中运行 3-5 次,验证各个环节的输出结果符合预期,再部署到生产环境。AI Skill Hub 评分 7.5 分,是同类 Agent 工作流中的精选推荐。
📋 工具概览

基于Kanban中心的Pi代理,使用token高效工具,安全防护,提高工作效率

开源AI工作流 是一套完整的 AI Agent 自动化工作流方案。通过可视化的节点编排,将复杂的多步骤任务拆解为清晰的自动化流程,实现全程无人值守的智能处理。支持与数百种外部服务和 API 无缝集成,适合构建数据处理管线、业务自动化和 AI 辅助决策系统。

GitHub Stars
⭐ 7
开发语言
TypeScript
支持平台
Windows / macOS / Linux
维护状态
轻量级项目,按需更新
开源协议
MIT
AI 综合评分
7.5 分
工具类型
Agent工作流
Forks
1
📖 中文文档
以下内容由 AI Skill Hub 根据项目信息自动整理,如需查看完整原始文档请访问底部「原始来源」。

基于Kanban中心的Pi代理,使用token高效工具,安全防护,提高工作效率

开源AI工作流 是一套完整的 AI Agent 自动化工作流方案。通过可视化的节点编排,将复杂的多步骤任务拆解为清晰的自动化流程,实现全程无人值守的智能处理。支持与数百种外部服务和 API 无缝集成,适合构建数据处理管线、业务自动化和 AI 辅助决策系统。

📌 核心特色
  • 可视化 Agent 工作流编排,无需编写复杂代码
  • 支持多步骤自动化任务链,实现全流程无人值守
  • 与外部 API、数据库和第三方服务无缝集成
  • 内置错误处理与自动重试机制,保障稳定运行
  • 提供可复用的自动化模板,快速在同类场景部署
🎯 主要使用场景
  • 自动化日常重复性工作,将精力集中于创造性任务
  • 构建数据采集 → 处理 → 输出的完整自动化管线
  • 实现跨平台、跨系统的数据流转和业务协同
以下安装命令基于项目开发语言和类型自动生成,实际以官方 README 为准。
安装命令
# 方式一:npm 全局安装
npm install -g agentcastle

# 方式二:npx 直接运行(无需安装)
npx agentcastle --help

# 方式三:项目依赖安装
npm install agentcastle

# 方式四:从源码运行
git clone https://github.com/SchneiderDaniel/agentcastle
cd agentcastle
npm install
npm start
📋 安装步骤说明
  1. 访问 GitHub 仓库获取工作流文件
  2. 在对应平台(Dify / Flowise / Make 等)中找到「导入工作流」功能
  3. 上传工作流文件
  4. 按照提示配置必要的环境变量和 API Key
  5. 运行测试确认流程正常后投入使用
以下用法示例由 AI Skill Hub 整理,涵盖最常见的使用场景。
常用命令 / 代码示例
# 命令行使用
agentcastle --help

# 基本用法
agentcastle [options] <input>

# Node.js 代码中使用
const agentcastle = require('agentcastle');

const result = await agentcastle.run(options);
console.log(result);
以下配置示例基于典型使用场景生成,具体参数请参照官方文档调整。
配置示例
# agentcastle 配置说明
# 查看配置选项
agentcastle --config-example > config.yml

# 常见配置项
# output_dir: ./output
# log_level: info
# workers: 4

# 环境变量(覆盖配置文件)
export AGENTCASTLE_CONFIG="/path/to/config.yml"
📑 README 深度解析 真实文档 完整度 54/100 查看 GitHub 原文 →
以下内容由系统直接从 GitHub README 解析整理,保留代码块、表格与列表结构。

AgentCastle: Kanban-Centred Pi AI Agent

License: MIT Pi PRs Welcome

Kanban-centred Pi agent with token-efficient tools, security guardrails, and efficient workflow enhancements. Docker + Pi AI — autonomous Kanban pipeline, sandboxed execution, real-time feedback.

---

3. Create matching branch in submodule (required before editing)

cd flask_blogs git checkout -b worktree-git-issue-42-add-user-authentication git push -u origin worktree-git-issue-42-add-user-authentication cd ..

2. Philosophy — Why build your own?

Everyone should build their own Pi. This repo is my personal Pi agent harness. Fork it as a starting point, but the real power comes from shaping it into your own — your preferred tools, your workflows, your guardrails.

Why? Every developer and every team is different. The most effective way of working with an AI coding harness is the one that fits your workflow, not a one-size-fits-all maximalist suite. A harness packed with every imaginable feature often gets in the way. The best harness is the one you build for yourself.

Customize ruthlessly. Make it yours.

---

4. Installation — How to set it up

Quick-start

git clone git@github.com:SchneiderDaniel/agentcastle.git
cd agentcastle
./agent-castle.sh

That's it. The wrapper script: 1. Builds the OCI image from docker/Dockerfile (first run, ~2 min; cached thereafter) 2. Starts the container with your repo bind-mounted, API keys loaded, and UID/GID mapped 3. Drops you into the Pi TUI inside the container

Step-by-step

1. Clone the repo

git clone git@github.com:SchneiderDaniel/agentcastle.git && cd agentcastle

2. Configure API keys ```bash cp docker/agent_env.example .agent_env

5. Orientation — What did I just install?

5.1 Architecture

┌────────────────────────────────────────────────────┐
│  Terminal (Docker)                                  │
│  ┌──────────────────────────────────────────────┐  │
│  │  Pi TUI (Terminal) — agentcastle theme       │  │
│  │  ┌──────────┐ ┌──────────┐ ┌──────────────┐ │  │
│  │  │ Exts     │ │ AI Prov │ │ Rich Footer  │ │  │
│  │  │ .pi/     │ │OpenCode  │ │branch model  │ │  │
│  │  │ exts/    │ │Go/...    │ │tokens TPS    │ │  │
│  │  └───┬──────┘ └──────────┘ └──────────────┘ │  │
│  │      │                                        │  │
│  └──────┼────────────────────────────────────────┘  │
└─────────┼───────────────────────────────────────────┘
          │
     ┌────▼────────────────────────────┐
     │  External tools                  │
     │  ┌──────────┐ ┌───────────────┐ │
     │  │ ctags    │ │ ast-grep      │ │
     │  │map_code- │ │structural_    │ │
     │  │base tool │ │search tool    │ │
     │  └──────────┘ └───────────────┘ │
     │  ┌──────────┐ ┌───────────────┐ │
     │  │ ripgrep  │ │ crawl4ai      │ │
     │  │ripgrep_  │ │Python venv    │ │
     │  │search    │ │(host browser) │ │
     │  └──────────┘ └───────────────┘ │
     └─────────────────────────────────┘

Key principle: All tools run locally. Web crawling runs on host (network-only for crawl). Ctags, ast-grep, ripgrep are system binaries invoked via pi.exec(). No MCP servers, no network-exposed tool endpoints.

5.2 Why extensions instead of MCP?

This project deliberately avoids the Model Context Protocol (MCP). All tools are pi extensions — TypeScript files in .pi/extensions/ that run inside the agent's Node.js runtime. No external MCP servers, no network-exposed tool endpoints, no separate processes.

Two reasons: security and token efficiency.

🔒 Security: MCP servers introduce a new attack surface (OWASP maintains the MCP Top 10). Extensions treat tool execution as a function call. No network layer = no network attack surface.

📉 Token Efficiency: MCP servers expose full JSON Schema tool descriptions to the LLM on every request. Pi extensions use prompt snippets — concise one-line descriptions (~50-120 tokens vs ~300-800 for MCP). Full schema is only loaded when the tool is actually called. Saves thousands of tokens per turn.

5.3 What's in the box — File Manifest

File/PathWhat it is
.pi/extensions/codebase-mapper.tsmap_codebase tool via universal-ctags
.pi/extensions/structural-analyzer.tsstructural_search tool via ast-grep
.pi/extensions/ripgrep-search.tsripgrep_search tool via ripgrep
.pi/extensions/crawl4ai/web_crawl tool: local crawl4ai → Apify → HTTP fallback
.pi/extensions/supervisor/Kanban-driven multi-agent orchestration
.pi/extensions/context-info/Rich TUI status bar, welcome banner, TPS
.pi/extensions/session-logger/Session logging to JSONL
.pi/extensions/ask-user/Interactive MC questions + CSV logger
.pi/extensions/caveman/Token-efficient communication protocol
.pi/extensions/format-on-save/Auto Prettier + ESLint after write/edit
.pi/extensions/lsp-auditor/LSP diagnostics pre-audit for supervisor
.pi/extensions/piignore.ts.piignore path blocking
.pi/extensions/tsc-checkpoint.ts/check command: tsc --noEmit
.pi/agents/researcher.mdResearcher agent (pipeline step 1)
.pi/agents/architect.mdArchitect agent (pipeline step 2)
.pi/agents/test-designer.mdTestDesigner agent (pipeline step 3)
.pi/agents/developer.mdDeveloper agent (pipeline step 4)
.pi/agents/auditor.mdAuditor agent (pipeline step 5)
.pi/settings.jsonSupervisor + context status bar config
.pi/themes/agentcastle.jsonDark cyberpunk TUI theme
.pi/prompts/issue-cutter.mdEpic → sub-issues with layer labels
.pi/prompts/issue-refinement.mdSocratic interview + MC refinement
.pi/prompts/extension-spec.mdExtension design PRD generator
.pi/prompts/handover.mdSession handover document
.pi/prompts/quiz-master.mdPR review quiz + auto-merge
.piignoreAgent path blocking (gitignore syntax)
AGENTS.mdCaveman protocol (active every session)
scripts/setup-github-project.shCreate GitHub Project from settings
scripts/session-query.shQuery JSONL session logs with jq
MakefileDeprecated — see ./agent-castle.sh for Docker-based launch
test/27+ unit/integration test files
flask_blogs/Submodule: Flask blog apps

5.4 Extensions Deep Dive

Pi auto-discovers extensions from .pi/extensions/ in the project root. No config file needed. No --extension flag.

ExtensionPurpose
**Codebase Mapper**map_codebase via universal-ctags. Returns symbol tree (classes, functions, variables) grouped by file.
**Structural Analyzer**structural_search via ast-grep. AST-aware pattern matching (function calls, try/catch, class defs).
**Ripgrep Search**ripgrep_search via ripgrep. Fast literal/regex code search, respects .gitignore.
**Supervisor**Kanban-driven multi-agent pipeline. Reads issue from GitHub project, dispatches agents in loop. Registers /supervisor <issue-number> command.
**Web Crawler**web_crawl: local crawl4ai → Apify cloud → HTTP fallback. Auto-installs venv + Chromium deps.
**Context Info**Rich TUI status bar (branch, model, tokens, TPS), welcome banner, animated working indicator.
**Session Logger**Logs sessions to .pi/sessions/<id>.jsonl. Generates .md reports with sub-agent output from supervisor pipeline. Toggle with /session-logger. Query with scripts/session-query.sh.
**Caveman Protocol**Token-efficient communication. Active via AGENTS.md. Configurable intensity levels.
**Ask User**Interactive MC picker for AI-to-user questions. Uses arrow-key navigation + CSV logging.
**Format on Save**Auto-formats TS/JS with Prettier + ESLint --fix after write/edit. Non-blocking lint warnings.
**PiIgnore**Blocks paths matching .piignore patterns from read/write/edit/bash. Supports negation (!).
**TSC Checkpoint**/check command runs tsc --noEmit on worktree. Used in pipeline Implementation→Audit.
**LSP Auditor**Runs real LSP diagnostics on modified files before merge. Groups by server, auto-retry (max 3). Called by supervisor.

5.5 Agent Definitions

Agents are Markdown files in .pi/agents/ with YAML frontmatter. The supervisor reads them at runtime.

AgentFileTools
**Researcher**researcher.mdread, bash, structural_search, ripgrep_search
**Architect**architect.mdread, bash, structural_search, ripgrep_search
**TestDesigner**test-designer.mdread, bash, structural_search, ripgrep_search
**Developer**developer.mdread, bash, write, edit, structural_search, ripgrep_search
**Auditor**auditor.mdread, bash, structural_search, ripgrep_search

All agents use opencode-go/deepseek-v4-flash model. Developer additionally uses format-on-save and tsc-checkpoint extensions.

5.6 Prompt Templates

Invocable via /name in Pi's editor:

TemplateUsageWhat it does
**issue-cutter**/issue-cutter <number>Split epic into ordered, testable sub-issues with layer labels. Auto-links children to parent via GraphQL.
**issue-refinement**/issue-refinement <number>Grill issue against codebase, Socratic interview via ask_user (≥3 MC options), replace body with concrete ACs.
**extension-spec**/extension-spec <idea>Design new extension or refactor existing one. Researches pi docs, audits TypeScript, produces PRD.
**handover**/handoverWrite handover doc summarizing conversation. Saves to tmp/ with datetime prefix.
**model-select**/model-select <objective>Research + recommend models per agent role. Crawls providers, benchmarks, pricing. Three objectives: cost-optimized, performance-optimized, balanced. Applies model: field in agent files.
**quiz-master**/quiz-masterList open PRs across repo + submodules, quiz reviewer on diff with MC questions, auto-merge if score ≥80%.

5.7 Tool Benchmark

Empirical token consumption comparing tool configurations on a real audit task ("Audit test coverage of chart/figure generation methods"). Config 4 (ripgrep) is the most token-efficient tool-enabled config.

ConfigAvg InputAvg OutputAvg TotalAvg Durationvs Config 2 (total)
1 — no tools159591,87015,842ms
2 — mapper14,9587,028281,50676,133msbaseline
3 — mapper + structural24,2645,056299,78462,461ms+6%
**4 — mapper + structural + rg****15,248****4,131****204,532****51,345ms****-27%**

Config 4 uses 27% fewer total tokens and runs 33% faster than mapper-only (config 2). The ripgrep fix resolved the earlier issue where ripgrep made token consumption worse.

The agent footer also shows a TPS (tokens-per-second) gauge during streaming, computed from a rolling 30s window, plus worktree name in brackets next to the branch when inside a git worktree.

Run with scripts/benchmark-tools.sh (2 runs per config). Results saved to scripts/benchmark-results/.

5.8 Skills

Currently no skills installed (.pi/skills/.gitkeep). Skills are used sparingly in this project — every skill's description injects ~50-150 tokens into the context window on every turn, causing context rot. Prefer extensions (concise prompt snippets) or prompt templates (lazy-loaded) over skills.

---

Legacy Installation (host-level)

For users who prefer a host-level install (Node.js, apt packages, Pi on bare metal), the original install scripts are preserved in scripts/legacy/:

FilePurpose
scripts/legacy/install.shAutomated apt + npm install for Ubuntu/Debian hosts
scripts/legacy/postinstall.shPatch Pi footer pipe separator

These scripts are deprecated — the Docker workflow is the supported path. They remain for reference and for users who cannot run Docker.

Edit .agent_env with your keys (e.g., APIFY_TOKEN)


**3. Launch**
bash ./agent-castle.sh

**4. Set provider (first session only)**
bash pi --provider opencode-go --api-key "your-key" ``` Exit with Ctrl+C twice. The provider is persisted in .pi/settings.json.

What happens under the hood

./agent-castle.sh runs docker compose up with: - Image built from docker/Dockerfile (Debian 12-slim, Node.js 22, Python 3, ctags, ripgrep, ast-grep, pi, gosu) - Repo root bind-mounted to /workspaces/main inside the container - .agent_env file mounted and sourced automatically - Host UID/GID mapped to container user agentuser (no permission issues with bind mounts) - Interactive TTY for the Pi TUI

---

8. Power User — The Multi-Agent Pipeline

The supervisor (/supervisor <issue-number>) is the heart of this harness. It takes a GitHub issue, runs it through 5 agent stages in a Kanban loop, creates git worktrees, runs quality gates, and creates pull requests — all autonomously.

8.1 Pipeline Flow

     ┌─────────────────────────────────────────────────────────────────────────┐
     │                         GITHUB PROJECT BOARD                           │
     │  ┌──────────┐ ┌──────────┐ ┌──────────┐ ┌──────────────┐ ┌─────────┐  │
     │  │ Research │ │Architect.│ │TestDesign│ │Implement.    │ │  Audit  │  │
     │  │          │ │          │ │          │ │              │ │         │  │
     │  └────┬─────┘ └────┬─────┘ └────┬─────┘ └──────┬───────┘ └────┬────┘  │
     │       │             │            │              │              │       │
     └───────┼─────────────┼────────────┼──────────────┼──────────────┼───────┘
             │             │            │              │              │
    ┌────────▼────────┐ ┌──▼────────┐ ┌─▼───────────┐ │    ┌─────────▼──────┐
    │  Researcher     │ │ Architect │ │ TestDesigner │ │    │   Auditor      │
    │  crawls web     │ │ proposes  │ │ writes       │ │    │   reviews      │
    │  for best       │ │ target    │ │ test plan    │ │    │   implements   │
    │  practices,     │ │ architec- │ │ from archi-  │ │    │   creates PR   │
    │  lib versions,  │ │ ture      │ │ tecture      │ │    │   or rejects   │
    │  pitfalls       │ │           │ │              │ │    │                │
    └────────┬────────┘ └──┬────────┘ └─┬───────────┘ │    └────────┬───────┘
             │             │            │              │             │
             ▼             ▼            ▼              │             ▼
     GitHub Comment   GitHub Comment  GitHub Comment   │    GitHub Comment
     ## Research      ## Architectu-  ## Test Plan      │    ## Audit Approved
     Findings         re Approach                       │    + PR created
                                                        │
                        ┌───────────────────────────────┘
                        │
                        ▼
              ┌──────────────────────┐
              │  QUALITY GATES       │
              │  ┌────────────────┐  │
              │  │ TSC --noEmit   │──│──→ pass → continue
              │  │ (tsc-checkpoint)│  │     fail → back to Implementation
              │  └────────────────┘  │
              │  ┌────────────────┐  │
              │  │ LSP pre-audit  │──│──→ pass → continue
              │  │ (lsp-auditor)  │  │     fail → back to Implementation
              │  │                │  │     (max 3 retries)
              │  └────────────────┘  │
              └──────────────────────┘
                        │
                        ▼
              ┌──────────────────────┐
              │  Auditor decision    │
              │  ┌──────────────┐    │
              │  │ APPROVED?    │──│──→ Yes → Create PR → DONE
              │  │              │    │     No  → back to Implementation
              │  └──────────────┘    │
              └──────────────────────┘
                        │
                        ▼
              ┌──────────────────────┐
              │  POST-PIPELINE       │
              │  Check PR for        │
              │  merge conflicts     │
              │  Auto-merge or       │
              │  dispatch Developer  │
              └──────────────────────┘

Loop rules: - Each agent posts a structured GitHub comment on the issue - Supervisor reads the agent's output for a completion marker to know the agent finished - If agent times out, supervisor logs it and stops - Auditor can reject → sends back to Implementation (counts as 1 rejection) - LSP/TSC errors → sends back to Implementation (does NOT count as rejection, max 3 retries) - maxRejections (default 5) stops the loop to prevent infinite cycles

8.2 Agent Deep Dive

#AgentEntry MarkerCompletion MarkerToolsThinkingRole
1**Researcher**ResearchRESEARCH_COMPLETEread, bash, structural_search, ripgrep_searchmediumCrawls 3-5 web pages on issue topic, synthesizes findings. Posts ## Research Findings. Never makes recommendations.
2**Architect**ArchitectureARCHITECTURE_COMPLETEread, bash, structural_search, ripgrep_searchhighApplies Clean Architecture, PEAA, Philosophy of Software Design principles. Proposes target architecture.
3**TestDesigner**TestDesignTEST_PLAN_COMPLETEread, bash, structural_search, ripgrep_searchmediumWrites test plan: unit, integration, characterization tests.
4**Developer**ImplementationIMPLEMENTATION_COMPLETEread, bash, write, edit, structural_search, ripgrep_searchlowImplements code in pre-created worktree, commits, pushes. Handles submodule changes.
5**Auditor**AuditAUDIT_APPROVED or AUDIT_REJECTEDread, bash, structural_search, ripgrep_searchmediumReviews code against architecture + test plan. Creates PR if approved, or rejects with specifics.

8.3 Git Worktree Lifecycle

Each issue gets an isolated git worktree. This prevents agents from interfering with each other and keeps main clean.

Branch naming: worktree-git-issue-<number>-<title-slug> (e.g., worktree-git-issue-42-add-user-authentication)

Worktree path: ../worktree-git-issue-<number>-<title-slug>/

Lifecycle (supervisor-owned):

1. Supervisor creates worktree before Developer dispatch
   └── git worktree add -b <branch> ../<branch> <defaultBranch>

2. Supervisor dispatches Developer agent with cwd=<worktree-path>
   └── Agent tools (write, edit, bash, read) resolve against worktree

3. Developer implements, commits, pushes (inside worktree via cwd)
   ├── git add -A
   ├── git commit -m "feat(#42): Add user auth"
   └── git push origin <branch>

4. Supervisor dispatches Auditor agent with same cwd=<worktree-path>
   └── git diff <defaultBranch>

5. On approval: Auditor creates PR
   └── gh pr create --repo owner/repo --base <defaultBranch> --head <branch> --title "feat(#42): ..." --body "Closes #42"

6. Post-pipeline: supervisor cleans up worktree
   ├── git worktree remove --force ../<branch>
   ├── git worktree prune
   └── git branch -D <branch>

Key rules: - Worktree is created and owned by the supervisor pipeline — agents never create or remove worktrees - Agent cwd is set to worktree path automatically — no cd needed in agent tasks - All Git operations happen inside the worktree (tools resolve against cwd) - Worktree persists across feedback loops (auditor reject → re-implement) - Supervisor cleans up worktree after pipeline completes (success, failure, or stop) - Configurable via supervisor.worktreeBase and supervisor.branchPrefix in .pi/settings.json

8.4 Submodule Strategy

When the repo has submodules, the Developer works on both repos simultaneously using a matched-branch pattern:

Main repo (agentcastle)          Submodule (flask_blogs)
│                                │
├─ Branch: worktree-git-...     ├─ Branch: worktree-git-... (same name)
├─ Commit includes submodule    ├─ Actual code changes
│  pointer update (pinned SHA)  │
└───────────────────────────────┴───────────────────────────────

Detailed workflow:

```

2. Init submodule (arrives in detached HEAD — by design)

git submodule update --init --recursive

5. Push submodule FIRST (critical order)

cd flask_blogs git add -A && git commit -m "feat(#42): Add user auth" git push origin worktree-git-issue-42-add-user-authentication cd ..

6. Push agentcastle (includes submodule pointer update)

git add -A git commit -m "feat(#42): Add user auth" git push origin worktree-git-issue-42-add-user-authentication


**Why submodule must be pushed first:** The agentcastle commit records a specific submodule SHA. If that SHA only exists locally, teammates get `fatal: reference is not a tree`. The `push.recurseSubmodules check` config blocks the push if submodule commits haven't been pushed — a safety net, not a replacement for correct order.

**Why submodules start in detached HEAD:** Git submodules pin a specific commit, not a branch. `git submodule update` checks out that exact commit. You must explicitly checkout a branch to make editable changes — standard Git behavior.

**Result:** Two branches with same name exist:
- `agentcastle:worktree-git-issue-42-add-user-authentication`
- `flask_blogs:worktree-git-issue-42-add-user-authentication`

**Disk usage note:** Each worktree clones submodules independently (under `.git/worktrees/<name>/modules/`). Not shared across worktrees — known Git design tradeoff.

**Auditor PR creation order:**
Step 1 — Create submodule PR FIRST (if submodule has changes): cd flask_blogs gh pr create --repo owner/flask_blogs --base main --head <branch> --title "feat(#42): ..."

Step 2 — Create main repo PR SECOND (includes submodule pointer): gh pr create --repo owner/agentcastle --base main --head <branch> --title "feat(#42): ..." --body "Closes #42"


#### 8.5 Quality Gates

Before transitioning `Implementation → Audit`, the supervisor runs two checks on the worktree:

**1. TSC Checkpoint** (`tsc-checkpoint` extension)
- Runs `npx tsc --noEmit` on the worktree
- Only runs if `tsconfig.json` exists
- Non-blocking if tsc binary not found

**2. LSP Pre-Audit** (`lsp-auditor` extension)
- Runs real LSP diagnostics on **modified files only** (git diff vs `defaultBranch`)
- Groups files by language server (TypeScript, Python, ESLint, etc.)
- Each group audited concurrently via separate LSP server process
- Auto-retries on errors (max 3 attempts), exponential backoff
- Only blocks if LSP server is available AND reports errors

**Decision table:**

| TSC | LSP | Outcome |
|-----|-----|---------|
| pass | pass | → Audit |
| pass | fail | → Implementation (retry LSP, max 3) |
| pass | N/A (no LSP) | → Audit |
| fail | (skipped) | → Implementation |
| N/A (no tsconfig) | pass | → Audit |

#### 8.6 Merge Conflict Resolution

After pipeline reaches `Done`, supervisor checks the created PR for merge conflicts:
PR created (pipeline done) └─ gh pr view ... --json mergeable ├─ No conflict → done └─ Conflict? └─ Ask user: fix? (ctx.ui.confirm) ├─ Yes → auto-merge attempt (git merge base) │ ├─ Success → git push → done │ └─ Fail → dispatch Developer agent to resolve └─ No → done

#### 8.7 GitHub Interaction

The supervisor interacts with GitHub on every step:

| Action | Method | Purpose |
|--------|--------|---------|
| `gh issue view <N> --json ...` | pi.exec | Fetch issue data (pre-filtered to trusted codeowners) |
| `gh project view <projectNumber> ...` | pi.exec | Get field IDs for status options |
| `gh project item-list <projectNumber> ...` | pi.exec | Find issue's project item, read current status |
| `gh api graphql ...` (set status) | pi.exec | Move issue to next status on board |
| `gh issue comment <N> --repo <R> --body <B>` | pi.exec | Agent posts structured comment |
| `gh pr create --repo <R> --base <B> --head <H>` | pi.exec | Auditor creates PR on approval |
| `gh pr view <branch> --json ...` | pi.exec | Post-pipeline merge conflict check |

**Security:** All issue data is **pre-filtered** before reaching agents — only the body (if author is a codeowner) and comments from trusted codeowners are passed. The agent is explicitly instructed: "Use ONLY the issue data provided above. Do NOT run `gh issue view`." This prevents prompt injection via untrusted issue comments.

#### 8.8 Configuration Reference

All supervisor settings in `.pi/settings.json` under the `supervisor` key:
jsonc { "supervisor": { "repo": "SchneiderDaniel/agentcastle", // REQUIRED — owner/repo format "projectNumber": 3, // REQUIRED — GitHub Project (v2) number "statusMapping": { // REQUIRED — board status → agent file "Research": "researcher", "Architecture": "architect", "TestDesign": "test-designer", "Implementation": "developer", "Audit": "auditor" }, "codeowners": ["SchneiderDaniel"], // REQUIRED — trusted GitHub usernames "statusField": "Status", // Single-select field on project board "maxRejections": 5, // Max Auditor rejections before loop stops "remote": "origin", // Remote name for git push "defaultBranch": "main", // Worktree base and PR target "worktreeBase": "../", // Parent dir for worktrees "branchPrefix": "worktree-git-issue-", // Prefix for auto-generated branch names "agentTimeoutsMin": { // Per-agent timeout (optional) "researcher": 10, "developer": 30 }, "submodules": [ // Auto-parsed from .gitmodules if absent { "path": "flask_blogs", "repo": "Owner/flask_blogs" } ] } }

#### 8.9 Complete Walkthrough

Here's what happens end-to-end when you run `/supervisor 42`:
You: /supervisor 42

── Step 1: Fetch ──────────────────────────────────────────────── Supervisor reads .pi/settings.json → repo, project board, statuses Fetches issue #42 from GitHub, filters to trusted codeowners only Reads issue's current status from project board → "Research"

── Step 2: Researcher ─────────────────────────────────────────── Spins up agent with researcher system prompt + issue data Agent crawls 3-5 web pages about the issue topic Posts: gh issue comment 42 --repo owner/repo --body "## Research Findings..." Outputs: RESEARCH_COMPLETE Supervisor moves issue → "Architecture" on board

── Step 3: Architect ──────────────────────────────────────────── Spins up agent with architect prompt + issue + research findings Analyzes codebase using read, bash, structural_search, ripgrep_search Proposes architecture following Clean Architecture + PEAA principles Posts: gh issue comment 42 --body "## Architecture Approach..." Outputs: ARCHITECTURE_COMPLETE Supervisor moves issue → "TestDesign"

── Step 4: TestDesigner ───────────────────────────────────────── Spins up agent with test-designer prompt + issue + architecture Writes test plan: unit, integration, characterization tests Posts: gh issue comment 42 --body "## Test Plan..." Outputs: TEST_PLAN_COMPLETE Supervisor moves issue → "Implementation"

── Step 5: Developer ──────────────────────────────────────────── Supervisor creates worktree: git worktree add -b <branch> ../<branch> main Spins up agent with developer prompt + issue + arch + test plan, cwd=<worktree-path> Implements feature, runs tests, formats code git add -A && git commit -m "feat(#42): ..." git push origin <branch> Outputs: IMPLEMENTATION_COMPLETE

── Step 6: Quality Gates ──────────────────────────────────────── TSC: runs npx tsc --noEmit on worktree → pass LSP: runs diagnostics on modified files → pass Supervisor moves issue → "Audit"

── Step 7: Auditor ────────────────────────────────────────────── Spins up agent with auditor prompt + all previous data, cwd=<worktree-path> git diff main (reviews changes) Reviews against architecture + test plan Decision: APPROVED ✔ Creates submodule PRs if needed Creates main PR: gh pr create --repo owner/repo --head <branch> --title "feat(#42): ..." Posts: ## Audit Approved Outputs: AUDIT_APPROVED Supervisor moves issue → "Done"

── Step 8: Post-pipeline ──────────────────────────────────────── Checks PR for merge conflicts If conflicted → asks you if you want to auto-fix If yes → attempts auto-merge If auto-merge fails → dispatches Developer to resolve

── Done ───────────────────────────────────────────────────────── Issue #42 is complete with a PR ready for final review. ```

Note: The walkthrough above shows the updated pipeline: dependency gate, in-process agent execution (live TUI widget), architecture-before-research sequence, auditor summary file protocol, and post-pipeline merge conflict resolution.

---

9. Troubleshooting — Something broke

Container doesn't start

Rebuild the image without cache:

docker compose build --no-cache
./agent-castle.sh

Web crawl fails with Chromium errors

The extension auto-installs system libraries inside the container. If it persists:

rm -rf .pi/crawl4ai-venv .pi/chromium-deps    # Next call auto-recreates

Permission errors on bind-mounted files

UID/GID mapping is automatic via agent-castle.sh. If you need to run manually:

HOST_UID=$(id -u) HOST_GID=$(id -g) docker compose up

gh auth status shows "not logged in"

Inside the container, run:

gh auth login

Authenticate with Login with a web browser.

.piignore blocking legitimate paths

Edit .piignore and add a negation pattern:

!path/to/allow
Reload: /reload

---

🎯 aiskill88 AI 点评 A 级 2026-05-23

该项目提供了一个开源的AI工作流解决方案,使用TypeScript编写,具有Kanban中心的Pi代理和token高效工具,安全防护,提高工作效率。

⚡ 核心功能
👥 适合人群
自动化工程师和运维人员项目经理和业务分析师希望减少重复性工作的专业人士数字化转型团队
🎯 使用场景
  • 自动化日常重复性工作,将精力集中于创造性任务
  • 构建数据采集 → 处理 → 输出的完整自动化管线
  • 实现跨平台、跨系统的数据流转和业务协同
⚖️ 优点与不足
✅ 优点
  • +MIT 协议,可免费商用
  • +大幅减少重复性人工操作
  • +可视化流程,清晰直观
  • +可扩展性强,支持复杂场景
⚠️ 不足
  • 初始配置和调试需投入一定时间
  • 强依赖外部服务的稳定性
  • 复杂场景需具备一定技术基础
⚠️ 使用须知

AI Skill Hub 为第三方内容聚合平台,本页面信息基于公开数据整理,不对工具功能和质量作任何法律背书。

建议在沙箱或测试环境中充分验证后,再部署至生产环境,并做好必要的安全评估。

📄 License 说明

✅ MIT 协议 — 最宽松的开源协议之一,可自由商用、修改、分发,仅需保留版权声明。

🔗 相关工具推荐
🧩 你可能还需要
基于当前 Skill 的能力图谱,自动补全的工具组合
❓ 常见问题 FAQ
解答
💡 AI Skill Hub 点评

总体来看,开源AI工作流 是一款质量良好的Agent工作流,在同类工具中具备一定竞争力。AI Skill Hub 将持续追踪其更新动态,建议收藏备用,结合自身场景选择合适时机引入使用。

⬇️ 获取与下载
⬇ 下载源码 ZIP

✅ MIT 协议 · 可免费商用 · 直接从 aiskill88 服务器下载,无需跳转 GitHub

📚 深入学习 开源AI工作流
查看分步骤安装教程和完整使用指南,快速上手这款工具
🌐 原始信息
原始名称 agentcastle
原始描述 开源AI工作流:Kanban-centred Pi agent with token-efficient tools, security guardrails, and eff。⭐7 · TypeScript
Topics workflowtypescript
GitHub https://github.com/SchneiderDaniel/agentcastle
License MIT
语言 TypeScript
🔗 原始来源
🐙 GitHub 仓库  https://github.com/SchneiderDaniel/agentcastle

收录时间:2026-05-22 · 更新时间:2026-05-23 · License:MIT · AI Skill Hub 不对第三方内容的准确性作法律背书。