Generated banner for Third Brain V8.1 Skills
Generated logo for Third Brain V8.1 Skills

Third Brain V8.1 Skills

LLM wiki kit

First committed by Mark393295827

Published in Mark393295827/third-brain-v7-skills. Publisher page

140 GitHub stars

What it is

agent wiki +engineering skills
— the description by Mark393295827

AutoGineer overview, from the brain’s own files

Third Brain V8.1 provides a structured, verification-first operating model for AI agents, treating the LLM as a CPU, context as RAM, and an Obsidian vault as a durable disk. It offers 21 reusable agent skills designed to manage knowledge ingestion, daily loops, research, and multi-agent orchestration. The system enforces strict provenance, governance, and quality gates, ensuring that agent actions are backed by evidence and that knowledge compounds over time through a structured taxonomy.

How it works

Memory model: LLM wiki

AutoGineer overview, from the brain’s own files

The system organizes information into a structured folder hierarchy including sources, concepts, entities, and maps. It uses a 5-stage worker assembly pipeline (Ingest, Cognitive, GraphWeaver, Governance, Deliverable) to process information. Skills are executed as programs within a harness that provides scheduling, permissions, and observability. It relies on a transactional runtime to manage state and ensure that all knowledge updates are verified and linked within the Obsidian vault.

Folders
FolderRoleFiles
.githubagent-config5
assetsattachments5
commandsagent-instructions4
docsdocs21
examplesexamples10
hookshooks1
skillsagent-instructions40
sourcesraw-sources13
teststests8
toolsscripts51
adaptersfolder2
artifactsfolder28
contractsfolder18
corefolder6
experimentsfolder7
mapsfolder1
outreachfolder46
systemfolder33
workflowsfolder1

Requirements

Works with: Claude Code, OpenAI Codex, GitHub Copilot, Cursor, Gemini CLI, Kiro, OpenCode, Amp, Cline, JetBrains Junie, Devin (ex-Windsurf)

Set it up

  1. This brain runs code automatically: 2 scripts. Review install.ps1, install.sh before opening the folder in Claude Code. No step below turns a hook on for you.

    • install.ps1: pwsh install.ps1
    • install.sh: sh install.sh
  2. Clone the repository at the commit AutoGineer scanned:

    git clone https://github.com/Mark393295827/third-brain-v7-skills.git && cd third-brain-v7-skills && git checkout 5a645148a108d71c76521715117b737ae60b1423
  3. Claude Code reads CLAUDE.md from this folder automatically.

  4. cd third-brain-v7-skills && claude

  5. AutoGineer scanned these files at commit 5a64514.

  6. First committed by Mark393295827. Published in Mark393295827/third-brain-v7-skills. Licence: MIT License.

Usage

AutoGineer overview, from the brain’s own files

  • Ingesting research papers or articles into a linked wiki
  • Running daily knowledge loops to compound insights
  • Enforcing verification gates before claiming task completion
  • Orchestrating multi-agent teams with isolated write scopes
  • Managing context budgets and state checkpoints for long-running tasks
“Use wiki-ingest on this source. Stage an immutable source, author a governed concept candidate, plan navigation updates, and return a verification summary.”
The agent creates an immutable note in the sources folder, updates the relevant concept pages in the wiki, and provides a summary of the verification steps taken.
“Run the daily-okr skill for today.”
The agent executes the 7-KR cycle, generating a daily insight, updating the wiki, and producing a receipt for the completed work.

Documentation by Mark393295827

Third Brain V8.1 Skills

<p align="center"> <img src="assets/third-brain-v8.1-actual-system-architecture.png" alt="Third Brain V8.1 actual Codex OS architecture: Codex host, repository control plane, transactional worker runtime, live Obsidian Vault, verification evidence, and declared debt" width="900"> </p>

Verification-first Agent Skills for Codex OS, with optional compatibility adapters for Claude Code, Gemini, Cursor, and Windsurf. Build a persistent knowledge operating system with Obsidian provenance, scheduled loops, bounded static dependency graphs, context management, and multi-agent orchestration.

Install 21 reusable agent skills for ingesting sources, auditing workflows, compiling interlinked wikis, running daily knowledge loops, verifying claims before shipping, managing token costs, engineering bounded loops and static dependency graphs, and orchestrating multi-agent teams.

Use this if:

  • Your AI agent keeps forgetting context between sessions

  • You want to enforce verification gates before "done" claims

  • You need to structure knowledge as linked pages (like Obsidian) instead of scattered chat history

  • You're building agent workflows that should learn and compound over time

  • You want Obsidian wiki knowledge to update skills, SOPs, schemas, and automation through supervised promotion gates

Image: GitHub stars Image: License: MIT Image: Codex OS Image: Claude Code Image: Cursor Image: PRs Welcome


Quick Start

1. Clone & Install
git clone https://github.com/Mark393295827/third-brain-v5-skills.git
cd third-brain-v5-skills
bash install.sh codex  # Codex is the primary host/kernel

Windows PowerShell uses .\install.ps1 codex. Compatibility adapters require an explicit non-Codex target.

2. Try a Skill

Paste this into Codex:

Use wiki-ingest on this source. Stage an immutable source, author a governed concept candidate, plan navigation updates, and return a verification summary. Treat entity authoring as a separate reviewed capability.

Then paste a URL, article, PDF text, or any source you want to capture.

3. Next Steps

See the 3-Minute Quickstart for a complete walkthrough.

Full guide: GUIDE.md

Command centre and distribution: V8.1 Codex Agentic OS command centre. Start it with python tools/agentic_os_server.py --state-root .agentic-os-state; the host is localhost-only by default and requires T02 runtime receipts. Claude/Gemini/Cursor/Windsurf remain compatibility adapters, not the primary runtime.

中文历史进阶手册:V7 最大潜力使用手册(参考)

🔥 V8.1 多智能体 Worker 流水线手册 & Worker Flows 规范:事务式流水线(Stage → Author → Graph Plan → Govern → Commit/Postcheck → optional Deliverable),归档只发生在验证提交之后。


The Problem

ScenarioBeforeAfter
Research PDFSummarized once, then forgottenwiki-ingest: source notes, concept pages, linked wiki
Coding sessionAgent: "I fixed it" (no proof)verify-before-claim: requires test output + exit code before any claim
Daily workTasks and ideas scatter across chatdaily-okr: one insight, one wiki update, one action, one output, daily score

V8.1 Operating Model

V8.1 keeps the wiki as durable disk and governance, gives every skill a profile-aware execution contract, and makes python -m tools.worker_flow.cli the only canonical transactional runtime:

Input -> Source -> Wiki compile -> Daily loop -> Agent/Wiki flywheel -> Skill/SOP upgrade -> Verification

The upgrade adds seven hard defaults:

  • Profiles match risk: one-shot, stateful, loop, and high-risk work load only the controls they need.

  • Source provenance stays immutable: raw source notes and block refs remain the audit layer.

  • Loops have contracts: Trigger -> Execute -> Verify -> State, with budgets and recovery.

  • Context is zero-overhead by default: hot paths load only what the task needs.

  • Automation is bounded: scans and queues can run unattended; semantic writes stay supervised.

  • Teams need ownership: multi-agent work requires write scopes, IPC, join gates, cleanup, and evidence.

  • Rules promote through evidence: wiki insights become schema or skill rules only after repeated support and a cheap check.

See the V8.1 Worker Flow, the Agent Skills standard, and the historical V7 release notes.

V8.1 keeps graph-engineering bounded to static DAGs; dynamic expansion and cyclic graphs remain out of scope.


Core Skills (Start Here)

🧠 Knowledge & Verification
SkillWhat it does
wiki-ingestPreserve an immutable source, compile linked understanding, enforce promotion boundaries, and verify every touched file.
verify-before-claimIron rule: no completion claim without fresh, scope-matched evidence; consequential actions also require independent verification, approval, and rollback.
📅 Daily Loop
SkillWhat it does
daily-okrExecute a 7-KR cycle: Input → Cognition → Wiki → Behavior → Creativity → Output → Feedback, with an artifact or receipt for every completed KR.
🎯 Behavior & Creativity
SkillWhat it does
behavior-designTurn outcomes into observable minimum behavior, cues, SOPs, recovery, evidence, and review.
creativity-engineGenerate mechanism-diverse options, rank evidence gaps, and define three bounded minimum experiments.
🔬 Research & Quality
SkillWhat it does
deep-researchSTOW-compatible research harness with evidence trails, source/claim ledgers, privacy checks, and direct handoff to wiki-ingest.
session-learnExtract knowledge patterns from sessions — concepts, entities, corrections, patterns, ideas, decisions, gaps. Closure protocol ensures learning feeds back into the wiki.
📊 Context & Engineering
SkillWhat it does
context-managerDerive budgets at runtime, checkpoint state, compact with KEEP/SUMMARIZE/DROP/RETRIEVE, and route by capability.
loop-engineeringControl temporal depth: turn repeatable work into a bounded Trigger -> Execute -> Verify -> State loop with durable state, finite budgets, and explicit stop/recovery rules.
graph-engineeringControl dependency width: validate bounded static DAGs with explicit dependencies, independent branches, typed joins, and node-local recovery.
agentic-engineeringDesign agent workflows as spec-driven macro actions with quality ceilings, verification gates, delegated-action boundaries, and state checkpoints.
harness-engineeringProvide the runtime scheduler, permissions, leases, tools, provenance, and observability needed to execute agent workflows safely.
agent-teams-commandAdmit and command multi-agent processes with exclusive ownership, typed IPC, isolated writes, serial integration, evidence, and cleanup.

Complete Skill List

📥 Ingestion & Knowledge
  • wiki-ingest — Stage immutable sources, author governed concept candidates, plan graph updates, and hand off optional entity authoring for separate review

  • knowledge-ops — Multi-layer knowledge management: classify, deduplicate, preserve evidence hierarchy, vector + Markdown retrieval

  • wiki-lint — Health check: P0/P1 graph health, frontmatter, source refs, wikilink density, provenance debt

🔄 Daily Workflow
  • daily-okr — 7-KR evidence cycle with minimum-day degradation and durable closeout

  • cognitive-compile — 8-section framework: Question → Facts → Concepts → Pattern Recognition → Conflict Detection → Hypothesis Generation

🎨 Behavior & Creativity
  • behavior-design — Outcome → minimum behavior → cue → SOP → evidence → review

  • creativity-engine — Mechanism-diverse combinations, scoring, and falsifiable minimum tests

🔬 Research & Quality
  • deep-research — STOW-compatible research harness, evidence trails, source/claim ledgers

  • verify-before-claim — Fresh scope-matched evidence, independent checks, approval, rollback

🔄 Learning & Flow
  • session-learn — 7 signal types: concepts, entities, corrections, patterns, ideas, decisions, gaps

  • project-flow-ops — Execution flow: triage, plan, track, review across projects

📊 Context
  • context-manager — Runtime budgets, checkpoint replay, compaction, retrieval, capability routing

Utility command: commands/token-cost-tracker.md estimates, logs, and reports token usage; it is not one of the 21 Agent Skills.

🏗️ Engineering
  • loop-engineering — Temporal depth through bounded loop contracts, independent verification, finite budgets, and stop/recovery rules

  • graph-engineering — Dependency width through bounded static DAGs, explicit branches, typed joins, and node-local recovery

  • agentic-engineering — Spec-driven macro actions, quality ceilings, verification gates, state checks

  • harness-engineering — Runtime scheduler, permissions, system-call tools, delegated gates, provenance, observability

  • agent-teams-command — Multi-agent process ownership, IPC, integration, async budgets, and evidence gates

💼 Strategy & Operations
  • startup-evaluation — Startup health: entrepreneurship, VC 5T, PMF, runway, team, unit economics

  • anthropic-os — Governed operating-system experiments: Four-C, 3B, prediction errors, permission ladder

  • ai-six-sigma-property-os — AI + Ontology + DMAIC for property work orders, dispatch, quotes, evidence


How These Skills Fit Together

                        LLM (CPU) + Context (RAM) + Wiki (Disk)

External Sources ──→ wiki-ingest + knowledge-ops ──→ Knowledge Layers
                            ↓
                    Daily Loop (daily-okr)
                    /    /    \    \    \
               Input  Cognition  Wiki  Behavior  Creativity
                            |
                        Output → Feedback
                            ↓
                    session-learn (extract patterns)
                            ↓
                    verify-before-claim (quality gate)
                             ↓
             Loop depth / Graph dependency width
                             ↓
                Multi-agent teams (agent-teams-command)

The system is a closed loop: ingest sources → process daily → extract learning → verify claims → promote rules → scale to teams.


Architecture & Design

Third Brain V8.1 treats agents as LLM OS processes:

  • LLM = CPU

  • Context = RAM

  • Wiki/Obsidian = Disk

  • Tools = System calls

  • Skills = Executable programs

  • Harness = Kernel

  • Agent teams = Processes

Design Layers
LayerPrincipleSkills
🧠 Knowledge OSCapture, structure, lint, and promote knowledge over timewiki-ingest, knowledge-ops, wiki-lint
⚡ Daily LoopClose the knowledge-to-action cycle every daydaily-okr, cognitive-compile
🎯 Behavior & CreativityTurn knowledge into habits and novel ideasbehavior-design, creativity-engine
🔬 Research & QualityVerify before claiming, research with rigordeep-research, verify-before-claim
🔄 Continuous LearningExtract patterns from every sessionsession-learn, project-flow-ops
📊 ContextManage hot context, durable checkpoints, and runtime budgetscontext-manager
🏗️ EngineeringDesign bounded loops, static dependency graphs, harnesses, agent workflows, and multi-agent systemsloop-engineering, graph-engineering, agentic-engineering, harness-engineering, agent-teams-command
💼 Strategy & OperationsEvaluate startups, design AI quality systemsstartup-evaluation, anthropic-os, ai-six-sigma-property-os

Engineering boundaries are deliberate: Loop Engineering controls temporal depth; Graph Engineering controls dependency width; Agent Teams Command controls process ownership, IPC, and integration; Harness Engineering supplies the runtime scheduler, permissions, and observability. A graph node may contain a Loop or Agent Team, but V8.1 does not support dynamic or cyclic graphs.


Skill Adoption Path

Start small. Add skills as you need them.

StageCore SkillsUnlock When
Week 1wiki-ingest + verify-before-claimYou can ingest 1 source/day + every claim has fresh evidence
Weeks 2-4+ daily-okr + session-learnDaily artifacts and verified learnings feed back to the wiki
Month 2++ cognitive-compile + behavior-design + creativity-engineWiki has 50+ pages or repeated decisions need synthesis
Month 3++ knowledge-ops + loop-engineering + harness-engineering + agentic-engineeringRetrieval, looping reliability, permissions, or delegated actions become bottlenecks
Dependency graph+ graph-engineering after loop-engineeringExplicit dependencies, independent branches, typed joins, or node-local recovery create more value than orchestration and review cost
Multi-agent+ agent-teams-command + project-flow-opsWork splits into separate owners with clear integration gates
Strategy+ startup-evaluation + anthropic-os + deep-researchNeed startup health, market, operating-system decisions
Operations+ ai-six-sigma-property-osNeed measurable service quality, dispatch, evidence loops

Installation

For Codex CLI (Primary host/kernel)
# Personal skills (available across all projects)
bash install.sh codex
For Cursor
bash install.sh cursor
For Windsurf
bash install.sh windsurf
Compatibility adapters: Claude Code / Gemini CLI
bash install.sh claude
bash install.sh gemini

Full guide: GUIDE.md


Example Workflows

Each workflow is copyable into your agent. See examples/ for complete, verified examples:


Wiki Structure

Skills default to STOW paths (configurable via system/config.md):

sources/          ← Immutable source notes (articles, PDFs, transcripts)
wiki/
├── concepts/     ← 13 contracted domains
├── entities/     ← people, companies, funds-investors, products, orgs
└── outputs/      ← gmail-digests, evaluations, compilations
maps/
├── domain-mocs/
├── system-indexes/
├── project-maps/
└── canvases/
system/           ← Deployed contracts, config, schema, templates, runs

Tools & References

ResourcePurpose
tools/index.htmlV8.1 visual skill navigator
tools/token-calculator.htmlHistorical V5 cost-model calculator; not a runtime authority
GUIDE.mdFull installation & troubleshooting
V7 最大潜力使用手册(历史参考)Earlier profile、知识飞轮、Agent 工程、治理和 30 天采用路径
CLAUDE.mdClaude Code setup
CONTRIBUTING.mdHow to contribute skills

What This Is NOT

  • Not a chat wrapper. Skills are executable prompts that agents follow; they're not productivity theater.

  • Not a productivity tool with 100 metrics. Daily OKR has seven causally linked KRs with evidence.

  • Not an all-in-one framework. Pick skills incrementally. You don't need all 20 to start.

  • Not prescriptive. Adapt paths, frontmatter, and skill triggers to your workflow.


Philosophy

Three core principles:

  1. Verification first: No "done" without proof. No claims without evidence. Expected value over confidence.

  2. Knowledge compounds: Every session should improve the wiki, not scatter across chat history.

  3. Closed loops: Ingest → Process → Learn → Scale → Verify. No loose ends.



Contributing

Bug reports, skill improvements, and PRs are welcome. See CONTRIBUTING.md and CHANGELOG.md.


License

MIT — see LICENSE.


Transparency Note

This project includes growth and outreach tools (in tools/ and outreach/) designed to help the repository reach users via GitHub search and Awesome lists. These tools are optional, dry-run-by-default, and separate from the core skills. If you're installing skills for your own workflow, you don't need them.

The skill frameworks and philosophy are genuine. Use what works for you; ignore what doesn't.

skills/graph-engineering/scripts/validate_graph_contract.py

Shown as plain text.

#!/usr/bin/env python3
"""Validate a bounded static Graph Engineering contract."""

from __future__ import annotations

import argparse
import json
import re
from pathlib import Path
from typing import Any, Dict, Iterable, List, Set, Tuple


REQUIRED_TOP_LEVEL = {
    "schema_version",
    "graph_id",
    "objective",
    "non_goals",
    "owner",
    "artifact_path",
    "state_path",
    "entry_nodes",
    "terminal_nodes",
    "budgets",
    "permission_boundary",
    "nodes",
    "edges",
    "joins",
    "stop_conditions",
    "recovery",
}
REQUIRED_BUDGETS = {
    "max_nodes",
    "max_concurrency",
    "max_attempts_per_node",
    "wall_time_seconds",
    "tool_calls",
    "review_changed_lines",
}
REQUIRED_NODE_FIELDS = {
    "id",
    "kind",
    "owner",
    "inputs",
    "outputs",
    "reads",
    "writes",
    "verifier",
    "timeout_seconds",
    "max_attempts",
    "tool_calls",
    "effect_class",
    "idempotency",
    "compensation",
}
REQUIRED_EDGE_FIELDS = {
    "from",
    "to",
    "type",
    "payload_schema",
    "condition",
    "failure_route",
}
REQUIRED_JOIN_FIELDS = {
    "id",
    "target",
    "mode",
    "inputs",
    "verifier",
    "quorum",
}
VALID_NODE_KINDS = {
    "deterministic",
    "loop",
    "agent",
    "agent-team",
    "human-gate",
    "subgraph",
}
VALID_EDGE_TYPES = {
    "data",
    "control",
    "verification",
    "failure",
    "compensation",
}
SCHEMA_EDGE_TYPES = {"data", "verification"}
DEPENDENCY_EDGE_TYPES = {"data", "control", "verification"}
VALID_JOIN_MODES = {
    "all",
    "reduce",
    "first-success",
    "quorum",
    "barrier-verifier",
    "human-gate",
}
VALID_EFFECT_CLASSES = {"read-only", "reversible", "external"}
NODE_ID_RE = re.compile(r"^[a-z0-9][a-z0-9-]{0,63}$")


def _is_non_empty_string(value: Any) -> bool:
    return isinstance(value, str) and bool(value.strip())


def _is_positive_int(value: Any) -> bool:
    return isinstance(value, int) and not isinstance(value, bool) and value > 0


def _string_list(value: Any) -> bool:
    return (
        isinstance(value, list)
        and all(_is_non_empty_string(item) for item in value)
        and len(value) == len(set(value))
    )


def _missing_fields(value: Dict[str, Any], required: Iterable[str]) -> List[str]:
    return sorted(field for field in required if field not in value)


def _detect_cycle(
    node_ids: Set[str],
    adjacency: Dict[str, Set[str]],
) -> bool:
    indegree = {node_id: 0 for node_id in node_ids}
    for source in node_ids:
        for target in adjacency.get(source, set()):
            if target in indegree:
                indegree[target] += 1

    ready = [node_id for node_id, degree in indegree.items() if degree == 0]
    visited = 0
    while ready:
        source = ready.pop()
        visited += 1
        for target in adjacency.get(source, set()):
            if target not in indegree:
                continue
            indegree[target] -= 1
            if indegree[target] == 0:
                ready.append(target)
    return visited != len(node_ids)


def _reachable(
    entries: List[str],
    adjacency: Dict[str, Set[str]],
) -> Set[str]:
    seen: Set[str] = set()
    stack = list(entries)
    while stack:
        node_id = stack.pop()
        if node_id in seen:
            continue
        seen.add(node_id)
        stack.extend(adjacency.get(node_id, set()) - seen)
    return seen


def validate(contract: Dict[str, Any], strict: bool = False) -> List[str]:
    errors: List[str] = []
    if not isinstance(contract, dict):
        return ["contract must be a JSON object"]

    for field in _missing_fields(contract, REQUIRED_TOP_LEVEL):
        errors.append("missing top-level field: %s" % field)
    if errors:
        return errors

    if contract["schema_version"] != "1.0":
        errors.append("schema_version must be 1.0")
    for field in ("graph_id", "objective", "owner", "artifact_path", "state_path"):
        if not _is_non_empty_string(contract.get(field)):
            errors.append("%s must be a non-empty string" % field)
    if not _string_list(contract.get("non_goals")) or not contract.get("non_goals"):
        errors.append("non_goals must be a non-empty unique string list")
    if not _string_list(contract.get("stop_conditions")) or not contract.get(
        "stop_conditions"
    ):
        errors.append("stop_conditions must be a non-empty unique string list")

    budgets = contract.get("budgets")
    if not isinstance(budgets, dict):
        errors.append("budgets must be an object")
        budgets = {}
    for field in _missing_fields(budgets, REQUIRED_BUDGETS):
        errors.append("missing budget: %s" % field)
    for field in REQUIRED_BUDGETS:
        if field in budgets and not _is_positive_int(budgets[field]):
            errors.append("%s must be a positive integer" % field)

    if strict:
        if _is_positive_int(budgets.get("max_nodes")) and budgets["max_nodes"] > 64:
            errors.append("max_nodes must be 64 or less in strict mode")
        if (
            _is_positive_int(budgets.get("max_concurrency"))
            and budgets["max_concurrency"] > 16
        ):
            errors.append("max_concurrency must be 16 or less in strict mode")
        if (
            _is_positive_int(budgets.get("max_attempts_per_node"))
            and budgets["max_attempts_per_node"] > 5
        ):
            errors.append("max_attempts_per_node must be 5 or less in strict mode")
        if (
            _is_positive_int(budgets.get("review_changed_lines"))
            and budgets["review_changed_lines"] > 1000
        ):
            errors.append("review_changed_lines must be 1000 or less in strict mode")

    permission = contract.get("permission_boundary")
    if not isinstance(permission, dict):
        errors.append("permission_boundary must be an object")
        permission = {}
    for field in ("allowed", "denied", "approval_required"):
        value = permission.get(field)
        if not isinstance(value, list) or not all(
            _is_non_empty_string(item) for item in value
        ):
            errors.append("permission_boundary.%s must be a string list" % field)
    if not _is_non_empty_string(permission.get("rollback")):
        errors.append("permission_boundary.rollback must be non-empty")

    recovery = contract.get("recovery")
    if not isinstance(recovery, dict):
        errors.append("recovery must be an object")
        recovery = {}
    for field in ("checkpoint", "write_back"):
        if not _is_non_empty_string(recovery.get(field)):
            errors.append("recovery.%s must be non-empty" % field)
    if not isinstance(recovery.get("whole_graph_rerun"), bool):
        errors.append("recovery.whole_graph_rerun must be boolean")
    elif strict and recovery["whole_graph_rerun"]:
        errors.append("strict static graphs must recover the smallest failed unit")

    nodes = contract.get("nodes")
    if not isinstance(nodes, list) or not nodes:
        errors.append("nodes must be a non-empty list")
        nodes = []

    node_map: Dict[str, Dict[str, Any]] = {}
    writers: Dict[str, List[str]] = {}
    external_nodes: Set[str] = set()
    total_node_tool_calls = 0

    for index, node in enumerate(nodes):
        label = "node[%d]" % index
        if not isinstance(node, dict):
            errors.append("%s must be an object" % label)
            continue
        for field in _missing_fields(node, REQUIRED_NODE_FIELDS):
            errors.append("%s missing field: %s" % (label, field))
        node_id = node.get("id")
        if not _is_non_empty_string(node_id) or not NODE_ID_RE.fullmatch(node_id):
            errors.append("%s id must match %s" % (label, NODE_ID_RE.pattern))
            continue
        if node_id in node_map:
            errors.append("duplicate node id: %s" % node_id)
            continue
        node_map[node_id] = node

        if node.get("kind") not in VALID_NODE_KINDS:
            errors.append("node %s has unsupported kind: %s" % (node_id, node.get("kind")))
        if not _is_non_empty_string(node.get("owner")):
            errors.append("node %s owner must be non-empty" % node_id)
        for field in ("inputs", "outputs", "reads", "writes"):
            if not _string_list(node.get(field)) and node.get(field) != []:
                errors.append("node %s %s must be a unique string list" % (node_id, field))
        if not _is_non_empty_string(node.get("verifier")):
            errors.append("node %s verifier must be non-empty" % node_id)
        for field in ("timeout_seconds", "max_attempts", "tool_calls"):
            if not _is_positive_int(node.get(field)):
                errors.append("node %s %s must be a positive integer" % (node_id, field))

        if (
            _is_positive_int(node.get("timeout_seconds"))
            and _is_positive_int(budgets.get("wall_time_seconds"))
            and node["timeout_seconds"] > budgets["wall_time_seconds"]
        ):
            errors.append("node %s timeout exceeds graph wall_time_seconds" % node_id)
        if (
            _is_positive_int(node.get("max_attempts"))
            and _is_positive_int(budgets.get("max_attempts_per_node"))
            and node["max_attempts"] > budgets["max_attempts_per_node"]
        ):
            errors.append("node %s max_attempts exceeds graph cap" % node_id)
        if _is_positive_int(node.get("tool_calls")):
            total_node_tool_calls += node["tool_calls"]

        effect_class = node.get("effect_class")
        if effect_class not in VALID_EFFECT_CLASSES:
            errors.append(
                "node %s has unsupported effect_class: %s"
                % (node_id, effect_class)
            )
        if not _is_non_empty_string(node.get("idempotency")):
            errors.append("node %s idempotency must be non-empty" % node_id)
        if effect_class == "read-only" and node.get("writes"):
            errors.append("read-only node %s cannot declare writes" % node_id)
        if effect_class == "external":
            external_nodes.add(node_id)
            if not _is_non_empty_string(node.get("compensation")):
                errors.append("external node %s requires compensation" % node_id)

        for target in node.get("writes", []) if isinstance(node.get("writes"), list) else []:
            if _is_non_empty_string(target):
                writers.setdefault(target, []).append(node_id)

    node_ids = set(node_map)
    if _is_positive_int(budgets.get("max_nodes")) and len(nodes) > budgets["max_nodes"]:
        errors.append("declared nodes exceed max_nodes")
    if (
        _is_positive_int(budgets.get("max_concurrency"))
        and _is_positive_int(budgets.get("max_nodes"))
        and budgets["max_concurrency"] > budgets["max_nodes"]
    ):
        errors.append("max_concurrency cannot exceed max_nodes")
    if (
        _is_positive_int(budgets.get("max_concurrency"))
        and nodes
        and budgets["max_concurrency"] > len(nodes)
    ):
        errors.append("max_concurrency cannot exceed declared node count")
    if (
        _is_positive_int(budgets.get("tool_calls"))
        and total_node_tool_calls > budgets["tool_calls"]
    ):
        errors.append("sum of node tool_calls exceeds graph tool_calls budget")
    for target, owners in sorted(writers.items()):
        if len(owners) > 1:
            errors.append("write target has multiple owners: %s" % target)

    edges = contract.get("edges")
    if not isinstance(edges, list):
        errors.append("edges must be a list")
        edges = []
    adjacency = {node_id: set() for node_id in node_ids}  # type: Dict[str, Set[str]]
    outgoing = {node_id: set() for node_id in node_ids}  # type: Dict[str, Set[str]]
    incoming = {node_id: set() for node_id in node_ids}  # type: Dict[str, Set[str]]
    compensation_sources: Set[str] = set()
    edge_keys: Set[Tuple[str, str, str, str]] = set()

    for index, edge in enumerate(edges):
        label = "edge[%d]" % index
        if not isinstance(edge, dict):
            errors.append("%s must be an object" % label)
            continue
        for field in _missing_fields(edge, REQUIRED_EDGE_FIELDS):
            errors.append("%s missing field: %s" % (label, field))
        source = edge.get("from")
        target = edge.get("to")
        edge_type = edge.get("type")
        payload = edge.get("payload_schema")
        if source not in node_ids or target not in node_ids:
            errors.append("edge references unknown node: %s -> %s" % (source, target))
            continue
        if source == target:
            errors.append("self edge is not allowed: %s" % source)
        if edge_type not in VALID_EDGE_TYPES:
            errors.append("unsupported edge type: %s" % edge_type)
        if not _is_non_empty_string(edge.get("condition")):
            errors.append("%s condition must be non-empty" % label)
        key = (source, target, str(edge_type), str(payload))
        if key in edge_keys:
            errors.append("duplicate edge: %s -> %s (%s)" % (source, target, edge_type))
        edge_keys.add(key)
        adjacency[source].add(target)
        outgoing[source].add(target)
        incoming[target].add(source)

        if edge_type in SCHEMA_EDGE_TYPES:
            if not _is_non_empty_string(payload):
                errors.append("%s payload_schema must be non-empty" % label)
            else:
                if payload not in node_map[source].get("outputs", []):
                    errors.append(
                        "%s edge schema %s is not declared by %s.outputs"
                        % (edge_type, payload, source)
                    )
                if payload not in node_map[target].get("inputs", []):
                    errors.append(
                        "%s edge schema %s is not declared by %s.inputs"
                        % (edge_type, payload, target)
                    )
        failure_route = edge.get("failure_route")
        if _is_non_empty_string(failure_route) and failure_route not in node_ids:
            errors.append("%s failure_route references unknown node: %s" % (label, failure_route))
        elif _is_non_empty_string(failure_route):
            # A failure route is an implicit control arc from the source node.
            # It must participate in the same reachability and cycle checks as
            # an explicit edge so recovery cannot hide a feedback loop.
            adjacency[source].add(failure_route)
            outgoing[source].add(failure_route)
            incoming[failure_route].add(source)
        if edge_type == "compensation":
            compensation_sources.add(source)

    entries = contract.get("entry_nodes")
    terminals = contract.get("terminal_nodes")
    if not _string_list(entries) or not entries:
        errors.append("entry_nodes must be a non-empty unique string list")
        entries = []
    if not _string_list(terminals) or not terminals:
        errors.append("terminal_nodes must be a non-empty unique string list")
        terminals = []
    for node_id in entries:
        if node_id not in node_ids:
            errors.append("unknown entry node: %s" % node_id)
        elif strict and incoming[node_id]:
            errors.append("entry node has incoming edge: %s" % node_id)
    for node_id in terminals:
        if node_id not in node_ids:
            errors.append("unknown terminal node: %s" % node_id)
        elif strict and outgoing[node_id]:
            errors.append("terminal node has outgoing edge: %s" % node_id)

    known_entries = [node_id for node_id in entries if node_id in node_ids]
    for node_id in sorted(node_ids - _reachable(known_entries, adjacency)):
        errors.append("unreachable node: %s" % node_id)
    if _detect_cycle(node_ids, adjacency):
        errors.append("static graph must be acyclic")

    joins = contract.get("joins")
    if not isinstance(joins, list):
        errors.append("joins must be a list")
        joins = []
    join_targets: Set[str] = set()
    join_ids: Set[str] = set()
    for index, join in enumerate(joins):
        label = "join[%d]" % index
        if not isinstance(join, dict):
            errors.append("%s must be an object" % label)
            continue
        for field in _missing_fields(join, REQUIRED_JOIN_FIELDS):
            errors.append("%s missing field: %s" % (label, field))
        join_id = join.get("id")
        target = join.get("target")
        inputs = join.get("inputs")
        mode = join.get("mode")
        if not _is_non_empty_string(join_id):
            errors.append("%s id must be non-empty" % label)
            join_id = label
        elif join_id in join_ids:
            errors.append("duplicate join id: %s" % join_id)
        join_ids.add(join_id)
        if target not in node_ids:
            errors.append("join %s references unknown target: %s" % (join_id, target))
            continue
        if target in join_targets:
            errors.append("multiple join contracts target node: %s" % target)
        join_targets.add(target)
        if mode not in VALID_JOIN_MODES:
            errors.append("join %s has unsupported mode: %s" % (join_id, mode))
        if not _string_list(inputs) or len(inputs) < 2:
            errors.append("join %s inputs must contain at least two unique nodes" % join_id)
            inputs = []
        for source in inputs:
            if source not in node_ids:
                errors.append("join %s references unknown input: %s" % (join_id, source))
            elif target not in adjacency.get(source, set()):
                errors.append(
                    "join %s input %s has no edge to %s"
                    % (join_id, source, target)
                )
        dependency_inputs = {
            edge.get("from")
            for edge in edges
            if isinstance(edge, dict)
            and edge.get("to") == target
            and edge.get("type") in DEPENDENCY_EDGE_TYPES
            and edge.get("from") in node_ids
        }
        if inputs and set(inputs) != dependency_inputs:
            errors.append("join %s inputs must match incoming dependencies" % join_id)
        if not _is_non_empty_string(join.get("verifier")):
            errors.append("join %s verifier must be non-empty" % join_id)
        quorum = join.get("quorum")
        if mode == "quorum":
            if not _is_positive_int(quorum) or quorum > len(inputs):
                errors.append(
                    "join %s quorum must be between 1 and %d"
                    % (join_id, len(inputs))
                )
        elif quorum is not None:
            errors.append("join %s quorum must be null unless mode is quorum" % join_id)
        if mode == "human-gate" and node_map[target].get("kind") != "human-gate":
            errors.append("join %s human-gate target must use kind human-gate" % join_id)

    for node_id in sorted(node_ids):
        dependency_sources = {
            edge.get("from")
            for edge in edges
            if isinstance(edge, dict)
            and edge.get("to") == node_id
            and edge.get("type") in DEPENDENCY_EDGE_TYPES
            and edge.get("from") in node_ids
        }
        if len(dependency_sources) > 1 and node_id not in join_targets:
            errors.append(
                "node %s has multiple incoming dependencies but no join contract"
                % node_id
            )

    approval_required = permission.get("approval_required")
    has_approval = isinstance(approval_required, list) and bool(approval_required)
    approval_scopes = (
        set(approval_required) if isinstance(approval_required, list) else set()
    )
    allowed_scopes = (
        set(permission.get("allowed", []))
        if isinstance(permission.get("allowed"), list)
        else set()
    )
    denied_scopes = (
        set(permission.get("denied", []))
        if isinstance(permission.get("denied"), list)
        else set()
    )
    for node_id in sorted(external_nodes):
        if not has_approval:
            errors.append("external node %s requires an approval boundary" % node_id)
        if node_id not in approval_scopes:
            errors.append(
                "external node %s must be named in approval_required" % node_id
            )
        approval_edges = [
            edge
            for edge in edges
            if isinstance(edge, dict)
            and edge.get("to") == node_id
            and edge.get("type") in SCHEMA_EDGE_TYPES
            and edge.get("from") in node_map
            and node_map[edge["from"]].get("kind") == "human-gate"
            and _is_non_empty_string(edge.get("payload_schema"))
            and "approval" in edge["payload_schema"].lower()
            and "receipt" in edge["payload_schema"].lower()
        ]
        if not approval_edges:
            errors.append(
                "external node %s requires a direct human-gate approval receipt"
                % node_id
            )
        node_writes = node_map[node_id].get("writes", [])
        if not isinstance(node_writes, list) or not node_writes:
            errors.append(
                "external node %s must declare at least one write target" % node_id
            )
        else:
            for target in node_writes:
                if target not in allowed_scopes:
                    errors.append(
                        "external node %s write target is not explicitly allowed: %s"
                        % (node_id, target)
                    )
                if target in denied_scopes:
                    errors.append(
                        "external node %s write target is denied: %s"
                        % (node_id, target)
                    )
        if node_id not in compensation_sources:
            errors.append("external node %s requires a compensation edge" % node_id)

    return errors


def load_contract(path: Path) -> Dict[str, Any]:
    try:
        value = json.loads(path.read_text(encoding="utf-8"))
    except json.JSONDecodeError as error:
        raise ValueError("invalid JSON at line %d: %s" % (error.lineno, error.msg))
    if not isinstance(value, dict):
        raise ValueError("contract must be a JSON object")
    return value


def main() -> int:
    parser = argparse.ArgumentParser(description=__doc__)
    parser.add_argument("contract", type=Path)
    parser.add_argument("--strict", action="store_true")
    parser.add_argument("--json", action="store_true")
    args = parser.parse_args()

    if not args.contract.is_file():
        parser.error("contract does not exist: %s" % args.contract)
    try:
        contract = load_contract(args.contract)
    except ValueError as error:
        print("FAIL graph contract")
        print("- %s" % error)
        return 1

    errors = validate(contract, strict=args.strict)
    result = {
        "contract": str(args.contract),
        "valid": not errors,
        "errors": errors,
        "graph_id": contract.get("graph_id"),
        "nodes": len(contract.get("nodes", []))
        if isinstance(contract.get("nodes"), list)
        else 0,
        "edges": len(contract.get("edges", []))
        if isinstance(contract.get("edges"), list)
        else 0,
    }
    if args.json:
        print(json.dumps(result, ensure_ascii=False, indent=2))
    elif errors:
        print("FAIL graph contract")
        for error in errors:
            print("- %s" % error)
    else:
        print("PASS graph contract")
        print("- graph_id: %s" % result["graph_id"])
        print("- nodes: %d" % result["nodes"])
        print("- edges: %d" % result["edges"])
        print("- entries: %s" % ", ".join(contract["entry_nodes"]))
        print("- terminals: %s" % ", ".join(contract["terminal_nodes"]))
    return 0 if not errors else 1


if __name__ == "__main__":
    raise SystemExit(main())
318 files · 7 not served here

Advantages

Limitations

  • Does not support dynamic or cyclic graphs; graph-engineering is bounded to static DAGs. evidence: README.md
  • Requires a specific transactional runtime for full functionality. evidence: AGENTS.md

Security

Risk level: Low risk

This brain runs

Agent instructions that run or fetch something (88)

  • AGENTS.md: V8.1 defines an explicit **5-Stage Worker Assembly Pipeline** in `workflows/worker-flows.md`, enforced by the canonical transactional runtime `python -m tools.worker_flow.cli`.
  • AGENTS.md: **loop-engineering** — Temporal-depth control through bounded Trigger → Execute → Verify → State loops, durable contracts, hard budgets, and stop/recovery rules.
  • AGENTS.md: `## Success Metrics` — minimum observable result for one successful run.
  • GEMINI.md: V8.1 defines a transactional **5-Stage Worker Assembly Pipeline** (`workflows/worker-flows.md`) enforced by `python -m tools.worker_flow.cli`.
  • skills/agent-teams-command/SKILL.md: <execute>
  • skills/agent-teams-command/SKILL.md: Run regression tests.
  • skills/agent-teams-command/SKILL.md: </execute>
  • skills/agentic-engineering/SKILL.md: Run the adoption gate: use an agent only when ambiguity/adaptation outweigh orchestration, verification, and maintenance cost.
  • skills/agentic-engineering/SKILL.md: <execute>
  • skills/agentic-engineering/SKILL.md: only host code may execute tools or decide continuation.
  • skills/agentic-engineering/SKILL.md: Run a thin loop: understand -> plan -> smallest change -> targeted test -> inspect diff/state -> broader check.
  • skills/agentic-engineering/SKILL.md: </execute>
  • skills/ai-six-sigma-property-os/SKILL.md: bounded agents execute and audit;
  • skills/ai-six-sigma-property-os/SKILL.md: <execute>
  • skills/ai-six-sigma-property-os/SKILL.md: </execute>
  • skills/anthropic-os/SKILL.md: Run Four-C in order: **Context** (truth/history), **Connections** (systems/accounts), **Capabilities** (skills/SOPs/evals), **Cadence** (triggers/reviews).
  • skills/anthropic-os/SKILL.md: <execute>
  • skills/anthropic-os/SKILL.md: Run dual prediction when useful: human and agent predict outcome independently;
  • skills/anthropic-os/SKILL.md: </execute>
  • skills/behavior-design/SKILL.md: <execute>
  • skills/behavior-design/SKILL.md: **H3 SOP:** write `trigger -> action -> evidence -> recovery -> stop` so a missed run has a next move.
  • skills/behavior-design/SKILL.md: </execute>
  • skills/behavior-design/SKILL.md: run a short observation period before optimizing.
  • skills/cognitive-compile/SKILL.md: <execute>
  • skills/cognitive-compile/SKILL.md: </execute>
  • skills/context-manager/SKILL.md: <execute>
  • skills/context-manager/SKILL.md: </execute>
  • skills/creativity-engine/SKILL.md: <execute>
  • skills/creativity-engine/SKILL.md: </execute>
  • skills/daily-okr/SKILL.md: Run one daily objective through seven linked Key Results.
  • skills/daily-okr/SKILL.md: <execute>
  • skills/daily-okr/SKILL.md: **Behavior:** execute one minimum behavior linked to the objective.
  • skills/daily-okr/SKILL.md: </execute>
  • skills/deep-research/SKILL.md: <execute>
  • skills/deep-research/SKILL.md: Run a broad discovery pass;
  • skills/deep-research/SKILL.md: Run a gap-fill pass only for decision-critical unknowns.
  • skills/deep-research/SKILL.md: Run an adversarial pass: strongest counterevidence, alternative mechanism, stale data, selection bias, and missing base rate.
  • skills/deep-research/SKILL.md: </execute>
  • skills/graph-engineering/SKILL.md: Run the admission gate before drawing a graph:
  • skills/graph-engineering/SKILL.md: Probe candidate independence with a small dry run.
  • skills/graph-engineering/SKILL.md: <execute>
  • skills/graph-engineering/SKILL.md: Write the JSON contract and run `scripts/validate_graph_contract.py <contract.json> --strict`.
  • skills/graph-engineering/SKILL.md: node success alone cannot certify graph success.
  • skills/graph-engineering/SKILL.md: </execute>
  • skills/graph-engineering/SKILL.md: run only independent ready nodes.
  • skills/harness-engineering/SKILL.md: Run the trace gate: the harness must be able to show what the agent saw, proposed, called, changed, and verified.
  • skills/harness-engineering/SKILL.md: <execute>
  • skills/harness-engineering/SKILL.md: The host decides whether to execute, continue, checkpoint, or escalate;
  • skills/harness-engineering/SKILL.md: </execute>
  • skills/harness-engineering/SKILL.md: Verify permissions with actual environment boundaries and run an independent end-to-end trace.
  • skills/harness-engineering/SKILL.md: A model emits plausible success text with a tool request: validate and execute the tool in host code, then verify its result;
  • skills/harness-engineering/SKILL.md: A maintenance run finds no eligible change: emit a verified `NO_OP` receipt and zero external outputs rather than creating notification or PR noise.
  • skills/harness-engineering/SKILL.md: The scheduler ran on time but the state store was stale: block mutation, mark the run failed, and recover from the last verified checkpoint.
  • skills/harness-engineering/SKILL.md: A Graph worker completes twice after lease expiry: deduplicate by node/run identity and release successors only from one verified transition.
  • skills/knowledge-ops/SKILL.md: <execute>
  • skills/knowledge-ops/SKILL.md: **Verify:** read after write, check links/source refs, rerun exact-identity search, and run representative retrieval queries.
  • skills/knowledge-ops/SKILL.md: Use idempotency keys for machine append operations: derive the key from operation, canonical source identity, target, and run/batch id;
  • skills/knowledge-ops/SKILL.md: </execute>
  • skills/knowledge-ops/SKILL.md: make no whole-vault claim.
  • skills/loop-engineering/SKILL.md: <skill_contract> <input>A repeatable task with inspectable state, finite budgets, permissions, and an independent verifier.</input> <output>A validated Trigger -> Execute -> Verify -> State contract plus resumable run receipts.</output> <done>The declared metric or stop condition is su …[+161 chars]
  • skills/loop-engineering/SKILL.md: **Goal:** run until a defined end state or cap.
  • skills/loop-engineering/SKILL.md: <execute>
  • skills/loop-engineering/SKILL.md: **Act:** execute one bounded action and capture artifact/diff/receipt.
  • skills/loop-engineering/SKILL.md: </execute>
  • skills/loop-engineering/SKILL.md: A scheduled job fired but produced no run receipt: status is triggered, not completed;
  • skills/project-flow-ops/SKILL.md: <execute>
  • skills/project-flow-ops/SKILL.md: Run the verification named in the definition of done.
  • skills/project-flow-ops/SKILL.md: </execute>
  • skills/session-learn/SKILL.md: <execute>
  • skills/session-learn/SKILL.md: **Pattern** — a reusable Trigger -> Execute -> Verify -> State sequence.
  • skills/session-learn/SKILL.md: </execute>
  • skills/startup-evaluation/SKILL.md: <execute>
  • skills/startup-evaluation/SKILL.md: </execute>
  • skills/verify-before-claim/SKILL.md: <execute>
  • skills/verify-before-claim/SKILL.md: Run the selected check after the final material change.
  • skills/verify-before-claim/SKILL.md: </execute>
  • skills/wiki-ingest/SKILL.md: record the identity query in the run ledger.
  • skills/wiki-ingest/SKILL.md: <execute>
  • skills/wiki-ingest/SKILL.md: Give every machine log entry an idempotency key derived from run/batch, operation, canonical source identity, and target;
  • skills/wiki-ingest/SKILL.md: **Verify:** run targeted link, source-ref, frontmatter, block-ref, empty-file, navigation, and post-write exact-identity checks over touched files.
  • skills/wiki-ingest/SKILL.md: </execute>
  • skills/wiki-lint/SKILL.md: make no content mutation unless separately authorized.
  • skills/wiki-lint/SKILL.md: <execute>
  • skills/wiki-lint/SKILL.md: Run twelve checks and preserve file-level evidence:
  • skills/wiki-lint/SKILL.md: </execute>
  • skills/wiki-lint/SKILL.md: If repair was authorized, run the relevant check again after each bounded repair.
  • skills/workflow-audit/SKILL.md: <execute> Extract a bounded list of distinct work candidates.
  • skills/workflow-audit/SKILL.md: </execute>

Install scripts (2)

  • install.ps1: pwsh install.ps1
  • install.sh: sh install.sh
  • Low risk: scripts-present (install.ps1)
  • Low risk: scripts-present (install.sh)

Attribution and licence

First committed by
GitHub avatar of Mark393295827Mark393295827
Publisher
Markk-gao (Community)
Source
Mark393295827/third-brain-v7-skills · commit 5a64514
Licence
MIT License (files served here)
  • ATTRIBUTION.md (written by AutoGineer)
Synced
Contributors
Mark393295827

AutoGineer is not affiliated with or endorsed by Mark393295827.

Install from source

7 of its files are not served here, so there is no ZIP. Mark393295827/third-brain-v7-skills at 5a64514