360 Secure SkillHub
360 安全技能中心

AI Company CTO AgentFactory

核心功能:遵循Harness工程原则,生成AI公司工具/执行/管理/决策四层Agent,符合ClawHub安全规范,支持批量生成,内置5道质量门与STRIDE威胁防护。典型场景:创建各层AI Agent、生成标准化岗位brief、设计Agent架构、批量搭建四层Agent团队。输入为YAML配置文件,输出含Agent目录、SKILL.md及配置文件,通过CLI命令操作。

johnsmithfan
johnsmithfan
热度 35.71
最近更新 2026-04-23 01:11:57
分类:开发依赖:代码执行 / 读写文件应用场景:自动化脚本 / 模板 / DevOps

安装技能

复制下面的话术发给你的 Agent,它会通过 secure-skills 检索并安装该技能。

执行命令安装此 skill: npx secure-skills-cli add ai-company-cto-agentfactory
Metadata
name
AI Company CTO AgentFactory
slug
ai-company-cto-agentfactory
version
1.1.0
homepage
https://clawhub.com/skills/ai-company-cto-agentfactory
description
A standardized Agent generation tool for the AI Company four-layer architecture. Follows Harness Engineering principles to generate Tool, Execution, Management, and Decision layer Agents, all compliant with ClawHub security specifications. The tool supports batch generation, quality gates, and CISO STRIDE threat mitigations.
license
MIT-0
tags
["ai-company","cto","agent-factory","agent-generation","harness-engineering","four-layer-architecture","tool-layer","execution-layer","management-layer","decision-layer"]
triggers
["generate agent","create agent","build agent","develop agent"]
layer
all
interface
{"input_format":"YAML configuration file","output_format":"Agent directory + SKILL.md + config.yaml","cli_command":"python scripts/generate_agent.py --config <path>"}
permissions
{"file_write":true,"file_read":true,"network":false,"execute_scripts":true}
install
{"requires":["python3.9+","pyyaml>=6.0","jinja2>=3.0"],"verify_command":"python -c \"import yaml, jinja2; print('ok')\""}
dependencies
{"runtime":["python3.9+","pyyaml>=6.0","jinja2>=3.0"],"skills":[]}
quality
{"saST":"Pass","vetter":"Approved","test_coverage":80,"documentation_score":"comprehensive","validation_gates":["schema_validation","lint_check","security_scan","integration_test"],"idempotent":true,"cqo_g2_gate":"documented"}
metadata
{"standardized":true,"harness_engineering":true,"clawhub_compliant":true,"category":"functional","layer":"FUNCTIONAL","cluster":"ai-company","maturity":"STABLE","stride_mitigations":"documented"}

AI-COMPANY-CTO-AgentFactory

When to Use

  • Create new AI Agents (any layer: tool/execution/management/decision)
  • Generate standardized Agent position briefs (five elements)
  • Design Agent architectures following Harness Engineering principles
  • Batch-generate four-layer architecture Agent teams

Core Rules

  1. Must specify agent layer — choose from tool/execution/management/decision
  2. Must include five elements — role, objective, behavior rules, tool permissions, error handling
  3. File names in kebab-case — e.g., content-writer-agent
  4. Configuration in YAML — structured, readable, verifiable
  5. Quality gates required after generation — 4 gates (schema/lint/security/integration)

Quick Reference

File Purpose
templates/*-layer.md Four-layer templates (Tool/Execution/Management/Decision)
scripts/generate_agent.py Main agent generation script
scripts/validate_agent.py Quality gate validation script
references/*.md Harness Engineering, quality gates, security compliance

Usage

# Generate an agent
python scripts/generate_agent.py --config ./agent-config.yaml --output ./agents/

# Validate quality gates
python scripts/validate_agent.py --agent-dir ./agents/my-agent/

# Dry-run (validate only, no file generation)
python scripts/generate_agent.py --config ./agent-config.yaml --dry-run

# Output JSON report
python scripts/validate_agent.py --agent-dir ./agents/my-agent/ --json --output report.json

Example: agent-config.yaml

agent:
  layer: execution
  name: content-writer-agent
  role: Content creation executor
  description: Generates copy/articles/social posts.

objective_kpi:
  metric: quality_score
  target: ">=4.5/5"
  measurement: Human sampling evaluation

behavior_rules:
  must_do:
    - Cite authoritative sources
    - Check factual accuracy
  must_not_do:
    - Generate misinformation
    - Disclose user privacy

tool_permissions:
  - skill: online-search
    access: read
  - skill: docx
    access: write

error_handling:
  retry_policy: 3x
  fallback_skill: general-knowledge

Four-Layer Architecture

Layer Responsibility Key Attributes
Tool Atomic capability Stateless, idempotent, reusable
Execution Task execution Single responsibility, bound to Skills
Management Task orchestration State machine, error recovery
Decision Strategic decisions Data-driven, authoritative citations

Quality Gates

Gate ID Check Threshold Blocking
Schema Validation G1 Required fields & YAML 100% coverage Yes
Lint Check G2 Markdown & file structure 0 errors Yes
Security Scan G3 Forbidden patterns 0 Critical/High Yes
Integration Test G4 Test coverage Pass rate >= 95% Yes
Layer Validation G5 Layer requirements All met Yes

CQO G2 Quality Gate — Lint Check Specification

The G2 Lint Check gate enforces:

  • Markdown structure: All required sections present (Overview, Capabilities, Usage, API)
  • File naming: kebab-case enforced for all generated files
  • YAML validity: Valid YAML syntax with proper indentation
  • Link integrity: No broken internal references
  • Line count: SKILL.md must be under 500 lines

Blocking: Any lint error blocks agent deployment.

Security Scanner — Forbidden Patterns

The scanner flags these patterns (blocking on detection):

Pattern Description
eval() Dynamic code execution
exec() Dynamic code execution
__import__(..system) System call via import
subprocess.(call/run/Popen) Subprocess spawning
pickle.loads Unsafe deserialization
yaml.load (without SafeLoader) Unsafe YAML parsing
40+ char base64-like strings Potential hardcoded keys

Note: The scanner legitimately uses eval() and exec() only inside tests (tests/test_factory.py) to verify it correctly detects these patterns. The actual production scripts use only safe APIs (yaml.safe_load, jinja2.sandbox.SandboxedEnvironment).

CISO STRIDE Mitigations

This skill implements security controls against STRIDE threats:

Threat Mitigation
Spoofing Agent config requires verified role definitions; YAML schema validates source identity
Tampering Security scanner blocks dangerous patterns; Jinja2 sandbox prevents template injection
Repudiation Audit logs generated for all agent creations; integration tests verify logging
Information Disclosure Network permission set to false; no credentials in generated output
Denial of Service Idempotent design prevents infinite loops; retry policies bounded
Elevation of Privilege Tool permissions explicitly scoped; execute_scripts requires explicit config

All generated agents inherit these security boundaries.

Harness Engineering — L1-L4 Layers

Layer Name Description
L1 Tool Layer Atomic, stateless, idempotent capabilities (e.g., file read, web search)
L2 Execution Layer Single-responsibility task executors bound to specific Skills
L3 Management Layer Orchestration with state machine, error recovery, retry logic
L4 Decision Layer Strategic C-Suite agents with authority, compliance, audit logging

The AgentFactory generates agents for any layer using standardized templates and validates layer-specific requirements through G5 gate.

Module Guide

Module 1: Agent Configuration & Schema

Define agent specifications in YAML. Required fields:

  • agent.layer, agent.name (kebab-case), agent.role
  • objective_kpi (metric/target/measurement)
  • behavior_rules (must_do / must_not_do lists)
  • tool_permissions (skill + access level)
  • error_handling (retry_policy / fallback_skill)

Module 2: Template Rendering

Uses Jinja2 SandboxedEnvironment for safe template rendering. Four layer templates are loaded from templates/:

  • tool-layer.md — stateless, idempotent atomic units
  • execution-layer.md — single-responsibility worker agents
  • management-layer.md — orchestration with state machine
  • decision-layer.md — strategic C-Suite agents

Module 3: Quality Gates

Five sequential gates (all blocking by default):

  1. SchemaValidator — frontmatter + config.yaml structural integrity
  2. LintChecker — line count, required sections, broken links
  3. SecurityScanner — regex scan for forbidden patterns
  4. IntegrationTester — test file existence + real test methods (no bare pass)
  5. LayerSpecificValidator — layer-keyword presence check

Module 4: Test Generation

Per-layer test templates with actual assertions:

  • Tool: schema compliance, stateless/idempotent verification
  • Execution: role definition, tool permissions declared
  • Management: state machine defined, error recovery paths
  • Decision: authority/compliance section, audit logging present

File Structure

ai-company-cto-agentfactory/
├── SKILL.md                    # This file
├── scripts/
│   ├── generate_agent.py       # Main generation script
│   └── validate_agent.py      # Quality gate validator
├── templates/
│   ├── tool-layer.md          # Tool layer template
│   ├── execution-layer.md    # Execution layer template
│   ├── management-layer.md   # Management layer template
│   └── decision-layer.md     # Decision layer template
├── references/
│   ├── harness-engineering.md
│   ├── quality-gates.md
│   └── security-compliance.md
├── tests/
│   └── test_factory.py       # Unit + integration tests
├── requirements.txt          # Python dependencies
├── CHANGELOG.md
├── DESIGN-SPEC.md
└── TECHNICAL-REVIEW-REPORT.md

Version History

Version Date Changes
1.0.0 2026-04-16 Initial release
1.1.0 2026-04-22 English rewrite; ClawHub Schema v1.0 compliance; execute_scripts:true; install block; saST/Vetter quality block; full four-layer template documentation; security scanner docs; CQO G2 lint gate documented; CISO STRIDE mitigations documented; Harness Engineering L1-L4 layers documented