AgentSkillsCN

agent-pocketflow

混合型PocketFlow + Nüm Agents示例代理。一款真实可用的LLM驱动代理,可自动更新项目文档(DM-Log、MCD、结构、任务、需求)。 演示BaseNode/Flow模式,搭配多供应商LLM客户端(Gemini/OpenAI/DeepSeek)、ASCII仪表盘、提示模板,以及Nüm Agents YAML规格。 可作为模板,用于构建您自己的代理。触发词包括“agent-pocketflow”、“/agent-pocketflow”、“构建文档代理”、“自动更新文档”、“PocketFlow代理示例”。

SKILL.md
--- frontmatter
name: agent-pocketflow
description: |
  Hybrid PocketFlow + Nüm Agents example agent. A real, working LLM-powered agent for auto-updating project documentation (DM-Log, MCD, structure, tasks, requirements). 
  Demonstrates BaseNode/Flow patterns with multi-provider LLM client (Gemini/OpenAI/DeepSeek), ASCII dashboard, prompt templates, and Nüm Agents YAML spec.
  Use as a template to build your own agents. Triggers on "agent-pocketflow", "/agent-pocketflow", "build a doc agent", "auto-update docs", "pocketflow agent example".

Agent PocketFlow — Hybrid Example Agent

A production-ready example showing how to build an LLM-powered agent by combining:

  • PocketFlow — Node/Flow engine with prep/exec/post lifecycle
  • Nüm Agents — Universe-based YAML spec architecture

What it does

Auto-updates project documentation by analyzing Git commits and using LLMs:

mermaid
flowchart LR
    G[Git Commit] --> P[Parse DM-Log]
    P --> L[LLM Generate]
    L --> U[Update Docs]
    U --> GP[Git Push]

Documents updated:

  • DM-Log (decision/meeting journal)
  • MCD & Garde-fous (data model + guardrails)
  • Project Structure
  • Tasks
  • Requirements

Quick Start

Run the full pipeline (test mode)

bash
cd skills/agent-pocketflow
python scripts/agent.py --test-mode

Run with Gemini

bash
export GEMINI_API_KEY="your-key"
python scripts/agent.py --provider gemini

Run specific flow only

bash
python scripts/agent.py --flow dm-log --test-mode

Architecture

code
┌─────────────────────────────────────────┐
│           agent.yaml (Nüm Agents)       │
│  Universes: PocketFlowCore,             │
│             StructureAgentIA,           │
│             KnowledgeLayer              │
├─────────────────────────────────────────┤
│           Flow Engine (PocketFlow)       │
│  Sequential node execution              │
│  ASCII dashboard + progress bar         │
│  Error handling per-node                │
├─────────────────────────────────────────┤
│           Nodes                         │
│  GitCommitNode → DMLogParserNode →      │
│  DMLogLLMNode → DMLogUpdateNode →       │
│  ModelConceptNode → StructureNode →     │
│  TasksNode → RequirementsNode →         │
│  GitPushNode                            │
├─────────────────────────────────────────┤
│          LLM Client                     │
│  Gemini / OpenAI / DeepSeek             │
│  Multi-provider, auto-detect API key    │
└─────────────────────────────────────────┘

Key Patterns

1. BaseNode (prep/exec/post)

python
from scripts.nodes.base_node import BaseNode

class MyNode(BaseNode):
    def __init__(self):
        super().__init__("my_node")
    
    def exec(self, context):
        # Your logic here
        context["result"] = "done"
        return context

2. LLM Node (multi-provider)

python
from scripts.llm_client import LLMClient

llm = LLMClient(provider="gemini")  # or "openai", "deepseek"
response = llm.generate_text("Analyze this code...")

3. Flow Composition

python
from scripts.flow import Flow

flow = Flow([
    MyNode(),
    AnotherNode(),
    FinalNode(),
], name="My Pipeline")

result = flow.run({"input": "data"})

4. Nüm Agents Spec

yaml
# agent.yaml
agent:
  name: DocUpdateAgent
  univers:
    - PocketFlowCore
    - StructureAgentIA
    - KnowledgeLayer
flows:
  - name: full-update
    nodes: [git_commit, dm_log, mcd, structure, tasks, requirements, git_push]

Create Your Own Agent

  1. Copy this skill as a template
  2. Edit agent.yaml — change universes, nodes, flows
  3. Create new nodes in scripts/nodes/ — extend BaseNode
  4. Add prompts to scripts/prompts.py
  5. Wire the flow in scripts/agent.py

Integration with other skills

SkillHow it integrates
pocketflowUses PocketFlow Node/Flow patterns
num-agentsUses YAML spec + universe architecture
orchestra-forgeUse orchestra-forge to generate this agent type
artifact-makerExport results as PDF/charts
nanoclaw-forgePart of the BUILD phase

Providers & API Keys

ProviderEnv VariableDefault Model
GeminiGEMINI_API_KEY or GOOGLE_API_KEYgemini-2.5-flash
OpenAIOPENAI_API_KEYgpt-4o
DeepSeekDEEPSEEK_API_KEYdeepseek-reasoner