Skip to content
goiltpatpatPublic

About

Evidence-driven autonomous agent engineering platform combining DeepSeek Harness execution primitives with Patpat engineering protocols

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Repository files navigation

Patze: Evidence-Driven Autonomous Agent Engineering Platform

English | 中文

License: MIT Node.js Architecture Engine Skills

Patze is an evidence-driven autonomous agent engineering platform designed for professional software developers and engineering organizations. It unifies the extensible microkernel architecture of DeepSeek Harness on Cordis with 22 disciplined Patpat engineering workflows, sub-2ms TypeSafe Jev System 1 decision gates, and native multimodal generative media execution.

The platform separates fast deterministic routing and safety from heavy reasoning models, maximizing GPU KV cache hits and enforcing strict proof contracts before committing any code changes.


Core Engineering Pillars

Pillar How Patze Implements It Benefit for Teams
Token Economy & Zero Bloat • Frozen System Prompt Prefix (90%+ KV Cache hit rate)
• @deepseek-ai/dsh-spill spills tool outputs >50KB to disk
• Jev System 1 routes intents in <2ms with 0 LLM tokens
Reduces API expenditure by up to 90%; eliminates context-window runaway on large repositories.
Disciplined Evidence Loop • 22 specialized Patpat workflows (architect, debug, verify, ship)
• Formal 5-field proof contracts (Claim, Surface, Action, Expect, Cleanup)
Prevents hallucinations and unverified claims; every diff must be proven on real runtime surfaces.
Dual-Engine Architecture • System 1 (Jev Engine): Active tools/pre-execute AgentShield and tools/post-execute proof watcher
• System 2 (Foundation LLM): DeepSeek V3/R1, Grok 4.6, Claude, Gemini, or Kimi
Fast, non-blocking guardrails run locally before expensive model calls are dispatched.
Autonomous Generative Media • Native xai_imagine_image (Grok Imagine Image 2.0)
• Asynchronous polling xai_imagine_video (Grok Imagine Video 1.5)
• Artifact persistence under artifacts/
Teams can generate production diagrams, visual designs, and UI motion clips directly from chat.

Architecture

                      ┌─────────────────────────────────┐
                      │    Operator / Developer Team    │
                      └────────────────┬────────────────┘
                                       │
                  ┌────────────────────┴────────────────────┐
                  ▼                                         ▼
       ┌──────────────────────┐                  ┌──────────────────────┐
       │   Web UI (:3080)     │                  │  Headless / CI CLI   │
       └──────────┬───────────┘                  └──────────┬───────────┘
                  │                                         │
                  └────────────────────┬────────────────────┘
                                       ▼
    ══════════════════════════════════════════════════════════════════════════
                     Cordis Microkernel & Patze Core
    ══════════════════════════════════════════════════════════════════════════
                                       │
        ┌──────────────────────────────┼──────────────────────────────┐
        ▼                              ▼                              ▼
  [Jev System 1]               [Agent Loop]                  [DeepSeek Engine]
  • tools/pre-execute          • Prompt Assembly             • Disk Spill (>50KB)
    (AgentShield Gate)         • Scope Parent Chain          • History Compaction
  • tools/post-execute         • Event-Sourced Log           • Preset Mounts
    (Diagnostic Watcher)         (SQLite / In-Memory)        • Plugin Manager
  • agent/pre-step             
    (0-Token Intent Steer)     
        │                              │                              │
        └──────────────────────────────┼──────────────────────────────┘
                                       ▼
    ══════════════════════════════════════════════════════════════════════════
                              Execution Layer
    ══════════════════════════════════════════════════════════════════════════
        │                              │                              │
        ▼                              ▼                              ▼
  [Foundation Models]          [22 Patpat Skills]            [Generative Tools]
  • DeepSeek V3 / R1           • .agents/skills/             • grok-imagine-image-2.0
  • xAI Grok 4.6               • Architect, Plan, Impact     • grok-imagine-video-1.5
  • Anthropic Claude           • Debug, Change, Verify       • Artifacts saved to
  • Google Gemini / Kimi       • Ship, Run, Swarm, Arena       artifacts/images & videos

Repository Layout

Patze/
├── bin/patze.js              # Platform CLI launcher (submodule bootstrap, .env, Cordis patch)
├── apps/desktop-preview/     # macOS preview launcher and isolated DSH profile integration
├── patches/                  # Compatibility patch for the pinned DSH release
├── config/cordis.yml         # Cordis configuration patch (injects patze-core and skill path)
├── src/
│   ├── index.js              # Core platform entry: mounts Jev, AgentShield, and Imagine tools
│   ├── index.ts              # TypeScript declaration and module exports
│   ├── jev/                  # System 1 Decision Layer
│   │   ├── engine.js         # Intent classifier (<2ms), AgentShield, and proof evaluator
│   │   ├── plugin.js         # Cordis active hooks (pre-execute, post-execute, pre-step)
│   │   ├── steer.js          # Turn-boundary steering policy
│   │   └── types.ts          # Structured decision contracts
│   └── tools/
│       ├── xai-imagine.js    # xAI Imagine Suite (Image 2.0 & asynchronous Video 1.5)
│       └── xai-imagine.test.js # xAI image and video tool tests
├── .agents/skills/           # 22 active Patpat engineering workflows + typesafe-ai
├── plugins/patpat/           # Upstream Patpat submodule
├── engine/deepseek-harness/  # DSH engine with standalone CLI and Desktop apps (v0.1.7-rc.1)
└── artifacts/                # Local generated media outputs (images/videos, gitignored)

Quickstart

Prerequisites

  • Node.js: ^22.19.0 || >=24.0.0
  • Package Manager: pnpm >=11.7.0
  • Environment: Linux, macOS, or Windows WSL2
  • Python: >=3.11 (for test runners and skill tooling)
  • Git: >=2.30

1. Clone & Bootstrap

git clone --recursive https://github.com/goiltpatpat/Patze.git
cd Patze
pnpm setup
cp .env.example .env

2. Configure Credentials

Edit .env with your API keys. Patze normalizes provider aliases automatically (e.g. GEMINI_API_KEY ↔ GOOGLE_API_KEY, KIMI_API_KEY ↔ MOONSHOT_API_KEY, TYPESAFE_API_KEY ↔ JEV_API_KEY):

# Primary LLM Providers
DEEPSEEK_API_KEY=
XAI_API_KEY=              # For Grok 4.6, Imagine Image 2.0 & Imagine Video 1.5
GEMINI_API_KEY=           # Or GOOGLE_API_KEY
MOONSHOT_API_KEY=         # Or KIMI_API_KEY
ANTHROPIC_API_KEY=        # For Claude models
OPENAI_API_KEY=           # For GPT models

# System 1 Optimization (Optional)
TYPESAFE_API_KEY=         # For TypeSafe System One (Choice / Score / Noul)

# Network & Server
PORT=3080
HOST=127.0.0.1

(Credentials can also be modified live inside the Web UI under Settings > Providers).

Optional curated Kimi and OpenAI profile

To create a separate Web profile with Kimi 2.6 and newer and GPT-6 Astra, Sol, and Luna, run pnpm models:init once, then start it with ./bin/patze.js --profile patze-curated --no-open. This creates $DSH_HOME/profiles/patze-curated (or ~/.dsh/profiles/patze-curated) and refuses to overwrite an existing profile. The existing web profile and provider settings are unchanged. Set MOONSHOT_API_KEY and/or OPENAI_API_KEY in the root .env or environment before using those providers. Model access depends on the API key's provider entitlement; the catalog does not test a live request. Sol and Luna are not yet in the pinned pi-ai catalog, so its cost estimate for those two models is zero until upstream supplies pricing. A home-level $DSH_HOME/cordis.patch.yml applies after this profile and can override its models.


Execution Modes

Mode A: Interactive Web UI

pnpm local
# Or select the project folder the agent should open with:
pnpm local --workspace "C:\Users\Brother\Documents\Project"
# Windows launcher:
start-brother-agent.bat --workspace "C:\Users\Brother\Documents\Project"
# or
pnpm web
# or: ./bin/patze.js web --no-open

pnpm local runs the full DeepSeek Harness Web Host on this machine, so the agent uses the logged-in OS account and the local profile for filesystem, terminal, model, and plugin settings. The authenticated Patze Online proxy is a separate control-plane surface; it does not own a paired device's DSH settings or provider directory.

Patze Online's shared DSH proxy is admin-only. Other accounts use the device dashboard; each user's full DSH agent and settings run through pnpm local on that user's machine.

To run Patze Online, configure at least one account's PATZE_<USER>_PASSWORD and PATZE_<USER>_PAIRING_SECRET values in .env first. The server binds to loopback only. For browser access over a network, put a TLS reverse proxy in front of 127.0.0.1, set PATZE_ONLINE_SECURE_COOKIES=true, and enable login rate limiting at the proxy. The alpha server does not implement login throttling and is not intended for direct internet exposure.

The legacy paired Host bridge caps requests at 1 MiB, terminal output at 512 KiB per stream, remote file reads and proxied DSH responses at 2 MiB, and directory listings at 1,000 entries. Use pnpm local on the user's machine for the full DeepSeek Harness agent and its local settings.

At startup, Patze outputs an authenticated loopback address:

dsh web: http://127.0.0.1:3080/?token=<one-time-token>

Open the URL printed by this process in your browser. The one-time token changes with the process; do not copy a live URL into documentation. Raw unauthenticated requests to http://127.0.0.1:3080 are rejected with HTTP 401 for security.

Mode B: macOS Desktop Preview

For a native MacBook test, run the preview from the Patze checkout on that Mac:

pnpm setup
pnpm desktop:preview

pnpm setup initializes the pinned DSH submodule, applies Patze's reviewed compatibility patch for that exact DSH revision, installs engine dependencies, and builds the engine. The DSH install runs in CI mode because its Git hook installer cannot safely migrate the Git metadata used by a submodule checkout; this skips DSH repository-only Git hooks, while Patze runtime permission checks remain active. The preview then launches DSH's Electron Desktop shell on the Mac, loads Patze's current config/cordis.yml and core, and runs its local agent with the signed-in macOS user's workspace permissions. Models, provider settings, plugins, terminal, and file access use a dedicated preview profile under ~/Library/Application Support/Patze Preview/dsh-home; generated media uses the sibling artifacts folder. Provider keys can be entered in Desktop Settings or supplied through the checkout's .env.

This is a source-based developer preview. It requires Node.js, pnpm, the repository checkout, and a successful native pnpm setup on the Mac. It does not produce a distributable .dmg or signed installer. Native Computer Use is not enabled in Patze's current profile. Set PATZE_DESKTOP_PREVIEW_HOME to select a different preview data directory; the launcher refuses to replace an existing unrelated Desktop profile patch.

Mode C: Headless & CI/CD Pipeline

Run autonomous tasks directly from terminal or CI workflows:

pnpm headless -- "Audit workspace dependencies and report security findings"
./bin/patze.js --profile headless "Analyze repository architecture"

Mode D: High-Speed CLI Utilities

Patze exposes deterministic CLI subcommands for rapid System 1 verification and media generation:

# System 1 Intent Routing (0 LLM tokens, < 2ms)
./bin/patze.js route "Fix memory leak in background worker queue"

# AgentShield Safety Gate Inspection
./bin/patze.js guard "rm -rf /var/log/*"

# Proof Contract Evaluation
./bin/patze.js evaluate "All 12 tests passed" "all unit tests pass"

# Autonomous Video Generation via Grok Imagine Video 1.5 (polls cluster and writes .mp4)
./bin/patze.js imagine-video "A robotic arm assembling high precision circuits in a clean room"

# Autonomous Image Generation via Grok Imagine Image 2.0 (writes .png)
./bin/patze.js imagine-image "Isometric architectural diagram of a distributed microkernel"

Generated media files are saved locally to artifacts/videos/ and artifacts/images/.


The Patpat Engineering Skill Matrix

Patze bundles 22 authoritative engineering workflows loaded from .agents/skills:

Domain Skills Primary Focus
Core Loop patpat, patpat-loop Standard evidence-driven engineering cycle.
Design & Architecture patpat-architect, patpat-plan, patpat-impact, patpat-inspect High-level system design, multi-phase contracts, blast radius analysis, and read-only audits.
Code Mutation patpat-change, patpat-engineer, patpat-debug Bounded minimal-diff modifications, delegated work slices, and defect root-cause reproduction.
Proof & Verification patpat-verify, patpat-verifier, patpat-review, patpat-eval Authoritative runtime surface assertions, custom verifier generators, skeptical peer reviews.
Delivery & Scale patpat-ship, patpat-run, patpat-swarm, patpat-arena, patpat-perf Pull request releases, resumable state machines, worker fan-out, competitive grafting, numeric optimization.
Platform Knowledge patpat-learn, patpat-skill, patpat-automation, patpat-setup Recurring mistake encoding, reusable SKILL.md authoring, external webhook automation.

The Evidence Loop

FRAME ──► INSPECT ──► PROOF CONTRACT ──► ACT ──► VERIFY ──► REVIEW ──► REPORT / SHIP
  1. FRAME: Define scope boundary and classify risk.
  2. INSPECT: Read live repository evidence before assuming root causes.
  3. PROOF CONTRACT: Define Claim, Surface, Action, Expect, Cleanup prior to editing.
  4. ACT: Execute the smallest safe mutation.
  5. VERIFY: Assert behavior against real compilers, test suites, or live HTTP endpoints.
  6. REVIEW / SHIP: Independent challenge before PR submission or deployment.

Quality Assurance & Verification

# Run Patze native unit test suite (Jev Router, Steer Policy, Imagine Suite)
pnpm run test:unit

# Update the pinned Patpat submodule and its owned skill copy locally
pnpm update-skills

# Syntax validation across all core modules
node --check src/index.js && node --check src/jev/engine.js && node --check src/jev/router.js && node --check src/tools/xai-imagine.js

# Full engine test suite
pnpm test

.agents/skills is a portable copy of the 22 skills in the pinned plugins/patpat submodule, plus Patze's own typesafe-ai skill. The updater checks ownership, preserves a rollback backup under ignored tmp/, and refuses changed owned files. The daily Patpat check fails when upstream advances, prompting pnpm update-skills and a reviewed PR with CI before changes enter main.


Technical Resources & Architecture Guides

License

Released under the MIT License.

About

Evidence-driven autonomous agent engineering platform combining DeepSeek Harness execution primitives with Patpat engineering protocols

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages