GridWork HQ
Knowledge Vault

Creating New Templates

Add custom pipeline definitions and templates to the knowledge vault.

Creating New Templates

GridWork HQ is designed to be extended. You can add new pipeline definitions, new document templates, and new client folder files without modifying any code.

Adding a New Pipeline

Pipelines are Markdown files discovered at runtime — no code changes required.

1. Create the Definition File

touch knowledge/system/rules/pipelines/my-pipeline.md

The filename must match /^[a-z0-9_-]+$/ (lowercase, hyphens, underscores only). The filename minus .md becomes the trigger name.

2. Add Frontmatter

---
type: pipeline
domain: client-delivery
status: active
model: sonnet
permissions: rw-knowledge
summary: One-line description of what this pipeline does
---

For multi-pass pipelines:

passes:
  - name: research
    model: sonnet
  - name: synthesis
    model: opus

3. Write the Body

Required sections:

> Read when this pipeline is triggered.

# MY-PIPELINE — Human-Readable Title

| | |
|---|---|
| **Trigger** | `my-pipeline [target]` |
| **Example** | `my-pipeline Acme Corp` |
| **Requires** | What the pipeline needs to run |
| **Output** | Where results are saved |

## Preflight Check (Run First — Every Time)

[Instructions for validating inputs before execution]

## Purpose

[What this pipeline accomplishes and why]

## Flow

### Pass 1 — [Name] ([Model])
[Step-by-step instructions]

## Output Format

[Template for the output file]

## Rules

[Constraints and guardrails]

## Error Handling

[What to do when tools or inputs are unavailable]

4. Register the Pipeline

Add a max-turns entry in pipeline-server/spawner.ts:

const PIPELINE_MAX_TURNS: Record<string, number> = {
  // ... existing entries
  'my-pipeline': 25,
};

Add the trigger to knowledge/system/CLAUDE.md Pipeline Triggers table.

5. Test

  1. Restart the pipeline server
  2. Trigger from Mission Control or via API:
curl -X POST http://localhost:8750/pipelines/run \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"pipeline": "my-pipeline", "args": "test target"}'

Adding a New Cron Job

See the Cron Jobs Configuration page for the complete guide.

Adding a New Dashboard Page

Dashboard pages use the Next.js App Router under the (dashboard) route group. See the product's ADVANCED_EXTENSIONS.md for the full guide including file structure, nav registration, and auth patterns.

Adding a New API Route

API routes live in gridwork-hq/src/app/api/. Every route must check getServerSession() and return 401 if unauthenticated. See ADVANCED_EXTENSIONS.md for patterns including error handling, rate limiting, and dynamic routes.

Adding a New Notion Database

You can add additional Notion databases beyond the default Leads and Clients databases. The process involves adding an env var, creating types and API functions in notion.ts, and creating an API route. See ADVANCED_EXTENSIONS.md for the complete walkthrough.

On this page