Newworker

From indigoai-us/hq-core · View interactive version

Newworker is an AI agent skill from the GitHub repository indigoai-us/hq-core. Scaffold a new HQ worker with skills, tools, and knowledge.

How to use this skill

Skill file

New Worker Builder

Create a new worker with proper structure, skills, and verification.

Technology: All HQ workers use TypeScript + Node.js (ESM). No Python for new workers.

PRDs live in personal/projects/ or companies/{co}/projects/ - Workers reference them, don't create their own. If the worker needs a PRD:

  1. Run /prd {worker-name} first to create the PRD
  2. Then return to /newworker to create the worker that references it

Context to Load First

  1. core/knowledge/public/workers/README.md - Worker framework
  2. core/knowledge/public/workers/templates/ - Worker templates
  3. core/workers/registry.yaml - Existing workers

Interactive Setup

Ask these questions (can batch related ones):

1. Identity

2. Skills

3. Execution

4. Context

5. Context Needs

Tip: Most workers can omit context_needs and rely on the files listed under context.

6. Verification

Generate Worker

First, resolve scope explicitly — do not infer silently. Ask (or confirm from clear context) whether this worker is:

A company-scoped worker placed in core/ would be lost on the next /update-hq wholesale-replace and leaks one tenant's specifics into the shared scaffold. When in doubt, default to company scope and confirm. See core/policies/hq-customizations-live-in-personal-or-company.md.

Then create the folder at the resolved path and echo the chosen scope + target path before scaffolding.

worker.yaml

worker:
  id: {worker-id}
  name: "{Human Name}"
  type: {WorkerType}
  version: "1.0"

identity:
  persona: {your-name}  # or company_context, voice_guide

execution:
  mode: {on-demand|scheduled|event-triggered}
  schedule: "{cron if scheduled}"
  max_runtime: 10m
  retry_attempts: 2

context:
  base:
    - {always-loaded-files}
  dynamic:
    - {per-task-files}
  exclude:
    - "*.log"
    - "node_modules/"

verification:
  post_execute:
    - {checks}
  approval_required: {true|false}

context_needs:
  # Optional. Only include when this worker needs files beyond `context`.
  required:
    - file: {context-file}
      reason: "{why this worker needs this}"

tasks:
  source: personal/projects/{associated-project}/prd.json  # Or companies/{co}/projects/{associated-project}/prd.json
  one_at_a_time: true

output:
  destination: workspace/{output-folder}/
  format: {markdown|json}

instructions: |
  {Worker-specific instructions and constraints}

Registry — Auto-Generated

core/workers/registry.yaml is an auto-generated index produced by core/scripts/generate-workers-registry.sh (invoked from .claude/hooks/reindex.sh on every Stop / PostToolUse-Write). Do not edit it directly. Just create the worker.yaml with worker.id, worker.type, worker.description and the registry regenerates automatically. Optional fields the generator picks up: worker.status (default "active"), worker.company, worker.team.

Context needs live on the worker

Do not write a shared core/knowledge/context-needs/ file. That tree is not in core. If this worker needs extra files, put them in its own worker.yaml context_needs block. Skip that block when context is enough.

Task Source Options

Workers can get tasks from:

  1. Project PRD (recommended): personal/projects/{project-name}/prd.json or companies/{co}/projects/{project-name}/prd.json
  1. Queue file: companies/{company}/workers/{worker-id}/queue.json (or core/workers/public/{worker-id}/queue.json for shared)

```json

{

"worker": "{worker-id}",

"tasks": []

}

```

Do NOT create prd.json inside worker directories. PRDs belong in personal/projects/ or companies/{co}/projects/.

Rules

After Creation

Register Worker

The worker.yaml you just created IS the registration. core/workers/registry.yaml regenerates from it automatically when reindex fires (Stop / PostToolUse-Write hook). No manifest edits required for shared workers; company-scoped workers are discovered via the worker.company: field inside their own worker.yaml.

To force an immediate regen: hq core generate-workers-registry.

Capture Learning (Auto-Learn)

Run /learn to register the new worker in the learning system:

{
  "source": "build-activity",
  "severity": "medium",
  "scope": "global",
  "rule": "Worker {worker-id} exists at companies/{company}/workers/{worker-id}/ (or core/workers/public/{worker-id}/ if shared) for {1-sentence purpose}",
  "context": "Created via /newworker"
}

Reindex + Update INDEX

  1. qmd update 2>/dev/null || true
  2. Regenerate core/workers/public/INDEX.md (shared workers) or companies/{company}/workers/INDEX.md (company workers) per core/knowledge/public/hq-core/index-md-spec.md.

Report to User

Provide next steps:

  1. "Worker created at companies/{company}/workers/{worker-id}/ (or core/workers/public/{worker-id}/ if shared)"
  2. "Registry auto-regenerated on next reindex (or run hq core generate-workers-registry to force)"
  3. "Test with on-demand execution first"
  4. If using queue: "Add tasks to queue.json to get started"
  5. If using PRD: "Run /prd {project-name} to create the PRD, then link it in worker.yaml"
Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.