@tiic-tech/openworkflow 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +37 -0
- package/dist/adapters/codex/src/doctorCodexAdapter.d.ts +6 -0
- package/dist/adapters/codex/src/doctorCodexAdapter.js +124 -0
- package/dist/adapters/codex/src/doctorCodexAdapter.js.map +1 -0
- package/dist/adapters/codex/src/generateAgents.d.ts +2 -0
- package/dist/adapters/codex/src/generateAgents.js +40 -0
- package/dist/adapters/codex/src/generateAgents.js.map +1 -0
- package/dist/adapters/codex/src/generateCodexAdapter.d.ts +9 -0
- package/dist/adapters/codex/src/generateCodexAdapter.js +59 -0
- package/dist/adapters/codex/src/generateCodexAdapter.js.map +1 -0
- package/dist/adapters/codex/src/generateCommands.d.ts +6 -0
- package/dist/adapters/codex/src/generateCommands.js +205 -0
- package/dist/adapters/codex/src/generateCommands.js.map +1 -0
- package/dist/adapters/codex/src/generateSkills.d.ts +7 -0
- package/dist/adapters/codex/src/generateSkills.js +60 -0
- package/dist/adapters/codex/src/generateSkills.js.map +1 -0
- package/dist/adapters/codex/src/generatedFiles.d.ts +4 -0
- package/dist/adapters/codex/src/generatedFiles.js +67 -0
- package/dist/adapters/codex/src/generatedFiles.js.map +1 -0
- package/dist/adapters/codex/src/manifest.d.ts +4 -0
- package/dist/adapters/codex/src/manifest.js +40 -0
- package/dist/adapters/codex/src/manifest.js.map +1 -0
- package/dist/adapters/codex/src/templates.d.ts +7 -0
- package/dist/adapters/codex/src/templates.js +6 -0
- package/dist/adapters/codex/src/templates.js.map +1 -0
- package/dist/cli/src/args.d.ts +8 -0
- package/dist/cli/src/args.js +34 -0
- package/dist/cli/src/args.js.map +1 -0
- package/dist/cli/src/commands/doctor.d.ts +1 -0
- package/dist/cli/src/commands/doctor.js +26 -0
- package/dist/cli/src/commands/doctor.js.map +1 -0
- package/dist/cli/src/commands/init.d.ts +1 -0
- package/dist/cli/src/commands/init.js +52 -0
- package/dist/cli/src/commands/init.js.map +1 -0
- package/dist/cli/src/commands/shared.d.ts +4 -0
- package/dist/cli/src/commands/shared.js +19 -0
- package/dist/cli/src/commands/shared.js.map +1 -0
- package/dist/cli/src/commands/sync.d.ts +1 -0
- package/dist/cli/src/commands/sync.js +27 -0
- package/dist/cli/src/commands/sync.js.map +1 -0
- package/dist/cli/src/commands/validate.d.ts +1 -0
- package/dist/cli/src/commands/validate.js +17 -0
- package/dist/cli/src/commands/validate.js.map +1 -0
- package/dist/cli/src/dev/validateRepositoryContractsCli.d.ts +2 -0
- package/dist/cli/src/dev/validateRepositoryContractsCli.js +37 -0
- package/dist/cli/src/dev/validateRepositoryContractsCli.js.map +1 -0
- package/dist/cli/src/dev/verifyRuntimeSurface.d.ts +2 -0
- package/dist/cli/src/dev/verifyRuntimeSurface.js +344 -0
- package/dist/cli/src/dev/verifyRuntimeSurface.js.map +1 -0
- package/dist/cli/src/dev/verifyWorkflowE2E.d.ts +2 -0
- package/dist/cli/src/dev/verifyWorkflowE2E.js +366 -0
- package/dist/cli/src/dev/verifyWorkflowE2E.js.map +1 -0
- package/dist/cli/src/index.d.ts +2 -0
- package/dist/cli/src/index.js +51 -0
- package/dist/cli/src/index.js.map +1 -0
- package/dist/core/src/artifacts/registry.d.ts +53 -0
- package/dist/core/src/artifacts/registry.js +483 -0
- package/dist/core/src/artifacts/registry.js.map +1 -0
- package/dist/core/src/commands/registry.d.ts +36 -0
- package/dist/core/src/commands/registry.js +539 -0
- package/dist/core/src/commands/registry.js.map +1 -0
- package/dist/core/src/contracts/index.d.ts +23 -0
- package/dist/core/src/contracts/index.js +16 -0
- package/dist/core/src/contracts/index.js.map +1 -0
- package/dist/core/src/contracts/yaml.d.ts +2 -0
- package/dist/core/src/contracts/yaml.js +12 -0
- package/dist/core/src/contracts/yaml.js.map +1 -0
- package/dist/core/src/contracts.d.ts +23 -0
- package/dist/core/src/contracts.js +15 -0
- package/dist/core/src/contracts.js.map +1 -0
- package/dist/core/src/fs/index.d.ts +4 -0
- package/dist/core/src/fs/index.js +28 -0
- package/dist/core/src/fs/index.js.map +1 -0
- package/dist/core/src/fs.d.ts +4 -0
- package/dist/core/src/fs.js +28 -0
- package/dist/core/src/fs.js.map +1 -0
- package/dist/core/src/initOpenWorkflow.d.ts +7 -0
- package/dist/core/src/initOpenWorkflow.js +220 -0
- package/dist/core/src/initOpenWorkflow.js.map +1 -0
- package/dist/core/src/validateOpenWorkflow.d.ts +5 -0
- package/dist/core/src/validateOpenWorkflow.js +145 -0
- package/dist/core/src/validateOpenWorkflow.js.map +1 -0
- package/dist/core/src/validators/validateOpenWorkflow.d.ts +5 -0
- package/dist/core/src/validators/validateOpenWorkflow.js +551 -0
- package/dist/core/src/validators/validateOpenWorkflow.js.map +1 -0
- package/dist/core/src/validators/validateRepositoryContracts.d.ts +2 -0
- package/dist/core/src/validators/validateRepositoryContracts.js +827 -0
- package/dist/core/src/validators/validateRepositoryContracts.js.map +1 -0
- package/dist/core/src/workflow/initOpenWorkflow.d.ts +7 -0
- package/dist/core/src/workflow/initOpenWorkflow.js +182 -0
- package/dist/core/src/workflow/initOpenWorkflow.js.map +1 -0
- package/dist/core/src/yaml.d.ts +2 -0
- package/dist/core/src/yaml.js +12 -0
- package/dist/core/src/yaml.js.map +1 -0
- package/package.json +55 -0
- package/references/artifact-authoring-templates.md +78 -0
- package/references/audit-first-discovery-loop.md +85 -0
- package/references/contract-graph.md +129 -0
- package/references/discovery-artifact-contracts.md +155 -0
- package/references/engineering-skill-reference-research.md +204 -0
- package/references/npm-cli-architecture.md +63 -0
- package/references/runtime-command-surface.md +169 -0
- package/schemas/artifact-contracts.schema.json +130 -0
- package/schemas/change.schema.json +71 -0
- package/schemas/contract-graph.schema.json +80 -0
- package/schemas/decision-record.schema.json +92 -0
- package/schemas/disclosure-levels.schema.json +66 -0
- package/schemas/openworkflow-contract.schema.json +88 -0
- package/schemas/product-design.schema.json +356 -0
- package/schemas/prototype-evidence.schema.json +325 -0
- package/schemas/prototype.schema.json +149 -0
- package/schemas/validation-target.schema.json +127 -0
- package/schemas/validation.schema.json +123 -0
- package/schemas/vision-session.schema.json +78 -0
- package/schemas/work-items.schema.json +87 -0
- package/schemas/workflow-index.schema.json +70 -0
- package/skills/build-prototype/SKILL.md +87 -0
- package/skills/build-prototype/agents/openai.yaml +4 -0
- package/skills/build-prototype/references/prototype-protocol.md +56 -0
- package/skills/build-prototype/scripts/init_prototype.py +260 -0
- package/skills/build-team/SKILL.md +292 -0
- package/skills/build-team/agents/openai.yaml +4 -0
- package/skills/build-team/references/runtime-schema.md +275 -0
- package/skills/build-team/references/team-protocol.md +244 -0
- package/skills/build-team/scripts/init_team_runtime.py +431 -0
- package/skills/build-validation/SKILL.md +81 -0
- package/skills/build-validation/agents/openai.yaml +4 -0
- package/skills/build-validation/references/validation-protocol.md +51 -0
- package/skills/build-validation/scripts/init_validation.py +194 -0
- package/skills/build-workflow/SKILL.md +65 -0
- package/skills/build-workflow/agents/openai.yaml +4 -0
- package/skills/build-workflow/references/workflow-layout.md +57 -0
- package/skills/build-workflow/scripts/init_workflow.py +423 -0
- package/skills/run-team/SKILL.md +93 -0
- package/skills/run-team/agents/openai.yaml +4 -0
- package/skills/run-team/references/delegation-and-agent-lifecycle.md +78 -0
- package/skills/run-team/references/run-loop.md +73 -0
- package/skills/run-team/references/runtime-audit.md +56 -0
- package/skills/run-team/references/scope-selection.md +64 -0
- package/skills/run-team/scripts/audit_team_runtime.py +173 -0
- package/skills/run-team/scripts/init_next_scope.py +304 -0
- package/templates/README.md +5 -0
- package/templates/codex/README.md +4 -0
- package/templates/openworkflow/README.md +4 -0
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: build-prototype
|
|
3
|
+
description: Turn a validation artifact into a focused prototype discovery plan and todo list. Use when the user wants to build the smallest local prototype for a core assumption before creating specs, changes, Agent Teams, runtime state, or production implementation plans.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Build Prototype
|
|
7
|
+
|
|
8
|
+
## Purpose
|
|
9
|
+
|
|
10
|
+
Create and execute the prototype discovery loop for one validation target. This
|
|
11
|
+
skill turns `VALIDATION.yaml` and `PROTOTYPE_BRIEF.md` into a constrained
|
|
12
|
+
prototype plan and todo contract.
|
|
13
|
+
|
|
14
|
+
Prototype work is not production work. It should answer the validation
|
|
15
|
+
question quickly, often with hardcoded data, a single HTML file, or a small
|
|
16
|
+
local demo.
|
|
17
|
+
|
|
18
|
+
## Inputs
|
|
19
|
+
|
|
20
|
+
Required:
|
|
21
|
+
|
|
22
|
+
- `.codex/validation/<validation_id>/VALIDATION.yaml`
|
|
23
|
+
- `.codex/validation/<validation_id>/PROTOTYPE_BRIEF.md`
|
|
24
|
+
|
|
25
|
+
Optional:
|
|
26
|
+
|
|
27
|
+
- `.codex/context/CONTEXT_MAP.yaml`
|
|
28
|
+
- `.codex/vision/VISION_CONTRACT.yaml`
|
|
29
|
+
- direct user constraints about the prototype medium or acceptance bar
|
|
30
|
+
|
|
31
|
+
Do not load unrelated specs, changes, runtime state, reviews, archives, or
|
|
32
|
+
implementation history unless the validation question explicitly depends on
|
|
33
|
+
them.
|
|
34
|
+
|
|
35
|
+
## Output
|
|
36
|
+
|
|
37
|
+
Write prototype artifacts under:
|
|
38
|
+
|
|
39
|
+
```txt
|
|
40
|
+
.codex/prototypes/<prototype_id>/
|
|
41
|
+
PROTOTYPE_PLAN.md
|
|
42
|
+
TODO.yaml
|
|
43
|
+
RESULT.md
|
|
44
|
+
EVIDENCE.md
|
|
45
|
+
artifact/
|
|
46
|
+
archive/
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
`TODO.yaml` is the machine-readable prototype contract. `PROTOTYPE_PLAN.md` is
|
|
50
|
+
the human-readable execution plan. `RESULT.md` and `EVIDENCE.md` are updated
|
|
51
|
+
after local review or user feedback.
|
|
52
|
+
|
|
53
|
+
## Workflow
|
|
54
|
+
|
|
55
|
+
1. Load the validation contract and prototype brief.
|
|
56
|
+
2. Keep the core question unchanged.
|
|
57
|
+
3. Convert prototype `include` scope into a short todo list.
|
|
58
|
+
4. Preserve `exclude` scope as hard boundaries.
|
|
59
|
+
5. Prefer the smallest artifact that a user can experience locally.
|
|
60
|
+
6. Initialize artifacts with `scripts/init_prototype.py`.
|
|
61
|
+
7. Implement the prototype directly when the user asks for execution and the
|
|
62
|
+
scope remains small enough for the main agent.
|
|
63
|
+
8. Use subagents only for narrow parallel work; prototype orchestration does not
|
|
64
|
+
require `/ow:team`.
|
|
65
|
+
9. Record what was tested in `EVIDENCE.md` and the user-facing outcome in
|
|
66
|
+
`RESULT.md`.
|
|
67
|
+
|
|
68
|
+
## Forbidden Defaults
|
|
69
|
+
|
|
70
|
+
- Do not create `SPEC.yaml`, `CHANGE.yaml`, `.codex/runtime/`, or Agent Team
|
|
71
|
+
artifacts from this skill.
|
|
72
|
+
- Do not add auth, persistence, deployment, billing, admin, upload, or full AI
|
|
73
|
+
integration unless the validation contract names that as the core assumption.
|
|
74
|
+
- Do not expand the prototype to cover later features.
|
|
75
|
+
- Do not treat code completeness as validation success; success means the core
|
|
76
|
+
question can be answered.
|
|
77
|
+
|
|
78
|
+
## Handoff
|
|
79
|
+
|
|
80
|
+
After user review, hand off to `/ow:decision`.
|
|
81
|
+
|
|
82
|
+
Expected decision outcomes:
|
|
83
|
+
|
|
84
|
+
- `continue`: prototype is strong enough to become a focused production slice
|
|
85
|
+
- `pivot`: adjust the vision or validation target
|
|
86
|
+
- `stop`: archive or clean the prototype path
|
|
87
|
+
- `needs_more_evidence`: revise the prototype scope and test again
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
# Prototype Discovery Protocol
|
|
2
|
+
|
|
3
|
+
Use this reference when creating or executing prototypes.
|
|
4
|
+
|
|
5
|
+
## Prototype Is Not Production
|
|
6
|
+
|
|
7
|
+
A prototype answers one validation question. It should not become a hidden
|
|
8
|
+
production implementation plan.
|
|
9
|
+
|
|
10
|
+
Allowed shortcuts:
|
|
11
|
+
|
|
12
|
+
- hardcoded sample data
|
|
13
|
+
- single HTML files
|
|
14
|
+
- local-only assets
|
|
15
|
+
- mocked LLM output
|
|
16
|
+
- fake persistence in memory
|
|
17
|
+
- narrow UI paths
|
|
18
|
+
|
|
19
|
+
Avoid by default:
|
|
20
|
+
|
|
21
|
+
- production database schemas
|
|
22
|
+
- authentication
|
|
23
|
+
- deployment setup
|
|
24
|
+
- full component architecture
|
|
25
|
+
- complete API design
|
|
26
|
+
- broad test matrices
|
|
27
|
+
- team runtime state
|
|
28
|
+
|
|
29
|
+
## Prototype Todo Shape
|
|
30
|
+
|
|
31
|
+
Todos should map directly to the validation include scope. Keep each item
|
|
32
|
+
experience-facing when possible:
|
|
33
|
+
|
|
34
|
+
```txt
|
|
35
|
+
create interactive globe
|
|
36
|
+
place sample flags
|
|
37
|
+
show hover thumbnails
|
|
38
|
+
open detail panel
|
|
39
|
+
verify user can answer the core question
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
Do not turn prototype todos into a full backlog.
|
|
43
|
+
|
|
44
|
+
## Evidence
|
|
45
|
+
|
|
46
|
+
Evidence can be lightweight:
|
|
47
|
+
|
|
48
|
+
- local URL or file path
|
|
49
|
+
- screenshot path
|
|
50
|
+
- user feedback summary
|
|
51
|
+
- known constraints
|
|
52
|
+
- decision recommendation
|
|
53
|
+
|
|
54
|
+
Evidence should be enough for `/ow:decision` to record continue, pivot,
|
|
55
|
+
stop, or needs_more_evidence.
|
|
56
|
+
|
|
@@ -0,0 +1,260 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""Initialize OpenWorkflow prototype discovery artifacts."""
|
|
3
|
+
|
|
4
|
+
from __future__ import annotations
|
|
5
|
+
|
|
6
|
+
import argparse
|
|
7
|
+
import json
|
|
8
|
+
import re
|
|
9
|
+
from pathlib import Path
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
def q(value: str | None) -> str:
|
|
13
|
+
return "null" if value is None else json.dumps(value)
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
def slugify(value: str) -> str:
|
|
17
|
+
return re.sub(r"[^A-Za-z0-9]+", "-", value.strip().lower()).strip("-") or "prototype"
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
def yaml_list(items: list[str], indent: int) -> str:
|
|
21
|
+
prefix = " " * indent
|
|
22
|
+
if not items:
|
|
23
|
+
return f"{prefix}[]\n"
|
|
24
|
+
return "".join(f"{prefix}- {q(item)}\n" for item in items)
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
def ensure_dir(path: Path, dry_run: bool) -> None:
|
|
28
|
+
if dry_run:
|
|
29
|
+
print(f"DIR {path}")
|
|
30
|
+
return
|
|
31
|
+
path.mkdir(parents=True, exist_ok=True)
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
def write_file(path: Path, content: str, force: bool, dry_run: bool) -> None:
|
|
35
|
+
if path.exists() and not force:
|
|
36
|
+
print(f"SKIP {path}")
|
|
37
|
+
return
|
|
38
|
+
if dry_run:
|
|
39
|
+
action = "OVERWRITE" if path.exists() else "WRITE"
|
|
40
|
+
print(f"{action} {path}")
|
|
41
|
+
return
|
|
42
|
+
path.parent.mkdir(parents=True, exist_ok=True)
|
|
43
|
+
path.write_text(content, encoding="utf-8")
|
|
44
|
+
print(f"WRITE {path}")
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
def touch_gitkeep(path: Path, dry_run: bool) -> None:
|
|
48
|
+
gitkeep = path / ".gitkeep"
|
|
49
|
+
if gitkeep.exists():
|
|
50
|
+
return
|
|
51
|
+
if dry_run:
|
|
52
|
+
print(f"WRITE {gitkeep}")
|
|
53
|
+
return
|
|
54
|
+
gitkeep.write_text("", encoding="utf-8")
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
def todo_yaml(args: argparse.Namespace, prototype_id: str, artifact_path: str) -> str:
|
|
58
|
+
todo_items = args.todo or [f"Build prototype surface for {item}" for item in args.include]
|
|
59
|
+
lines = [
|
|
60
|
+
"schema_version: 0.1.0",
|
|
61
|
+
f"contract_id: prototype:{prototype_id}",
|
|
62
|
+
"contract_type: prototype",
|
|
63
|
+
f"title: {q(args.title)}",
|
|
64
|
+
"status: planned",
|
|
65
|
+
"source_artifacts:",
|
|
66
|
+
]
|
|
67
|
+
lines.extend(f" - {q(source)}" for source in args.source_artifact)
|
|
68
|
+
lines.extend(
|
|
69
|
+
[
|
|
70
|
+
"depends_on:",
|
|
71
|
+
f" - {args.validation_contract}",
|
|
72
|
+
"produces: []",
|
|
73
|
+
f"validation_contract: {args.validation_contract}",
|
|
74
|
+
f"core_question: {q(args.core_question)}",
|
|
75
|
+
"prototype_scope:",
|
|
76
|
+
" include:",
|
|
77
|
+
]
|
|
78
|
+
)
|
|
79
|
+
lines.extend(f" - {q(item)}" for item in args.include)
|
|
80
|
+
lines.append(" exclude:")
|
|
81
|
+
lines.extend(f" - {q(item)}" for item in args.exclude)
|
|
82
|
+
lines.append("todo:")
|
|
83
|
+
for index, item in enumerate(todo_items, start=1):
|
|
84
|
+
task_id = f"P{index:03d}"
|
|
85
|
+
lines.extend(
|
|
86
|
+
[
|
|
87
|
+
f" - task_id: {task_id}",
|
|
88
|
+
f" title: {q(item)}",
|
|
89
|
+
" status: planned",
|
|
90
|
+
" acceptance:",
|
|
91
|
+
f" - {q('Prototype demonstrates: ' + item)}",
|
|
92
|
+
]
|
|
93
|
+
)
|
|
94
|
+
lines.extend(
|
|
95
|
+
[
|
|
96
|
+
"acceptance:",
|
|
97
|
+
*[f" - {q(item)}" for item in args.acceptance],
|
|
98
|
+
"artifact:",
|
|
99
|
+
f" path: {artifact_path}",
|
|
100
|
+
f" type: {args.artifact_type}",
|
|
101
|
+
"decision_handoff:",
|
|
102
|
+
" target: /ow:decision",
|
|
103
|
+
" requires_user_review: true",
|
|
104
|
+
"result_artifact: RESULT.md",
|
|
105
|
+
"evidence_artifact: EVIDENCE.md",
|
|
106
|
+
"prototype_plan: PROTOTYPE_PLAN.md",
|
|
107
|
+
"updated_at: null",
|
|
108
|
+
]
|
|
109
|
+
)
|
|
110
|
+
return "\n".join(lines) + "\n"
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
def prototype_plan(args: argparse.Namespace, prototype_id: str, artifact_path: str) -> str:
|
|
114
|
+
return f"""# Prototype Plan: {args.title}
|
|
115
|
+
|
|
116
|
+
Prototype id: `prototype:{prototype_id}`
|
|
117
|
+
|
|
118
|
+
Validation source: `{args.validation_contract}`
|
|
119
|
+
|
|
120
|
+
## Core Question
|
|
121
|
+
|
|
122
|
+
{args.core_question}
|
|
123
|
+
|
|
124
|
+
## Build
|
|
125
|
+
|
|
126
|
+
{bullet_list(args.include)}
|
|
127
|
+
|
|
128
|
+
## Do Not Build
|
|
129
|
+
|
|
130
|
+
{bullet_list(args.exclude)}
|
|
131
|
+
|
|
132
|
+
## Artifact
|
|
133
|
+
|
|
134
|
+
- Path: `{artifact_path}`
|
|
135
|
+
- Type: `{args.artifact_type}`
|
|
136
|
+
|
|
137
|
+
## Acceptance
|
|
138
|
+
|
|
139
|
+
{bullet_list(args.acceptance)}
|
|
140
|
+
|
|
141
|
+
## Decision Handoff
|
|
142
|
+
|
|
143
|
+
After local review, use `/ow:decision` to record whether this prototype
|
|
144
|
+
supports `continue`, `pivot`, `stop`, or `needs_more_evidence`.
|
|
145
|
+
"""
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
def result_doc(args: argparse.Namespace, prototype_id: str) -> str:
|
|
149
|
+
return f"""# Prototype Result: {args.title}
|
|
150
|
+
|
|
151
|
+
Prototype id: `prototype:{prototype_id}`
|
|
152
|
+
|
|
153
|
+
Status: pending user review
|
|
154
|
+
|
|
155
|
+
## Outcome
|
|
156
|
+
|
|
157
|
+
Pending. Do not create production specs or changes until `/ow:decision`
|
|
158
|
+
records the outcome.
|
|
159
|
+
"""
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
def evidence_doc(args: argparse.Namespace, prototype_id: str, artifact_path: str) -> str:
|
|
163
|
+
return f"""# Prototype Evidence: {args.title}
|
|
164
|
+
|
|
165
|
+
Prototype id: `prototype:{prototype_id}`
|
|
166
|
+
|
|
167
|
+
## Artifact
|
|
168
|
+
|
|
169
|
+
- `{artifact_path}`
|
|
170
|
+
|
|
171
|
+
## Review Notes
|
|
172
|
+
|
|
173
|
+
- Pending local review.
|
|
174
|
+
|
|
175
|
+
## Known Constraints
|
|
176
|
+
|
|
177
|
+
- Prototype scope excludes production hardening unless explicitly listed in
|
|
178
|
+
`TODO.yaml`.
|
|
179
|
+
"""
|
|
180
|
+
|
|
181
|
+
|
|
182
|
+
def artifact_placeholder(args: argparse.Namespace, prototype_id: str) -> str:
|
|
183
|
+
return f"""<!doctype html>
|
|
184
|
+
<html lang=\"en\">
|
|
185
|
+
<head>
|
|
186
|
+
<meta charset=\"utf-8\">
|
|
187
|
+
<meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">
|
|
188
|
+
<title>{args.title}</title>
|
|
189
|
+
<style>
|
|
190
|
+
body {{ font-family: system-ui, sans-serif; margin: 2rem; line-height: 1.5; }}
|
|
191
|
+
main {{ max-width: 760px; }}
|
|
192
|
+
code {{ background: #f4f4f4; padding: 0.1rem 0.25rem; }}
|
|
193
|
+
</style>
|
|
194
|
+
</head>
|
|
195
|
+
<body>
|
|
196
|
+
<main>
|
|
197
|
+
<h1>{args.title}</h1>
|
|
198
|
+
<p><strong>Prototype id:</strong> <code>prototype:{prototype_id}</code></p>
|
|
199
|
+
<p><strong>Core question:</strong> {args.core_question}</p>
|
|
200
|
+
<p>Replace this placeholder with the smallest local artifact that can answer the validation question.</p>
|
|
201
|
+
</main>
|
|
202
|
+
</body>
|
|
203
|
+
</html>
|
|
204
|
+
"""
|
|
205
|
+
|
|
206
|
+
|
|
207
|
+
def bullet_list(items: list[str]) -> str:
|
|
208
|
+
if not items:
|
|
209
|
+
return "- None."
|
|
210
|
+
return "\n".join(f"- {item}" for item in items)
|
|
211
|
+
|
|
212
|
+
|
|
213
|
+
def init_prototype(args: argparse.Namespace) -> None:
|
|
214
|
+
root = Path(args.root).expanduser().resolve()
|
|
215
|
+
prototype_id = args.prototype_id or slugify(args.title)
|
|
216
|
+
target = root / ".codex" / "prototypes" / prototype_id
|
|
217
|
+
artifact_dir = target / "artifact"
|
|
218
|
+
archive_dir = target / "archive"
|
|
219
|
+
artifact_path = f".codex/prototypes/{prototype_id}/artifact/{args.artifact_name}"
|
|
220
|
+
|
|
221
|
+
for directory in [target, artifact_dir, archive_dir]:
|
|
222
|
+
ensure_dir(directory, args.dry_run)
|
|
223
|
+
touch_gitkeep(archive_dir, args.dry_run)
|
|
224
|
+
|
|
225
|
+
write_file(target / "TODO.yaml", todo_yaml(args, prototype_id, artifact_path), args.force, args.dry_run)
|
|
226
|
+
write_file(target / "PROTOTYPE_PLAN.md", prototype_plan(args, prototype_id, artifact_path), args.force, args.dry_run)
|
|
227
|
+
write_file(target / "RESULT.md", result_doc(args, prototype_id), args.force, args.dry_run)
|
|
228
|
+
write_file(target / "EVIDENCE.md", evidence_doc(args, prototype_id, artifact_path), args.force, args.dry_run)
|
|
229
|
+
if args.artifact_type == "single_html":
|
|
230
|
+
write_file(artifact_dir / args.artifact_name, artifact_placeholder(args, prototype_id), args.force, args.dry_run)
|
|
231
|
+
else:
|
|
232
|
+
touch_gitkeep(artifact_dir, args.dry_run)
|
|
233
|
+
|
|
234
|
+
|
|
235
|
+
def parser() -> argparse.ArgumentParser:
|
|
236
|
+
p = argparse.ArgumentParser(description="Initialize prototype discovery artifacts.")
|
|
237
|
+
p.add_argument("--root", default=".", help="Repository root.")
|
|
238
|
+
p.add_argument("--prototype-id", default=None, help="Stable prototype slug.")
|
|
239
|
+
p.add_argument("--title", required=True, help="Prototype title.")
|
|
240
|
+
p.add_argument("--validation-contract", required=True, help="Upstream validation contract id.")
|
|
241
|
+
p.add_argument("--source-artifact", action="append", default=[], help="Source artifact path. Repeatable.")
|
|
242
|
+
p.add_argument("--core-question", required=True, help="The validation question this prototype answers.")
|
|
243
|
+
p.add_argument("--include", action="append", default=[], help="Prototype inclusion. Repeatable.")
|
|
244
|
+
p.add_argument("--exclude", action="append", default=[], help="Prototype exclusion. Repeatable.")
|
|
245
|
+
p.add_argument("--todo", action="append", default=[], help="Prototype todo. Repeatable.")
|
|
246
|
+
p.add_argument("--acceptance", action="append", default=[], help="Acceptance evidence. Repeatable.")
|
|
247
|
+
p.add_argument("--artifact-type", default="single_html", help="Artifact type, default single_html.")
|
|
248
|
+
p.add_argument("--artifact-name", default="index.html", help="Artifact filename.")
|
|
249
|
+
p.add_argument("--force", action="store_true", help="Overwrite existing artifacts.")
|
|
250
|
+
p.add_argument("--dry-run", action="store_true", help="Print writes without changing files.")
|
|
251
|
+
return p
|
|
252
|
+
|
|
253
|
+
|
|
254
|
+
def main() -> int:
|
|
255
|
+
init_prototype(parser().parse_args())
|
|
256
|
+
return 0
|
|
257
|
+
|
|
258
|
+
|
|
259
|
+
if __name__ == "__main__":
|
|
260
|
+
raise SystemExit(main())
|
|
@@ -0,0 +1,292 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: build-team
|
|
3
|
+
description: Build or regenerate a repo-specific Agent Team workflow from the current repository goal. Use when the user invokes /ow:team CONTENT or asks Codex to create, adapt, or formalize an Agent Team with orchestrator/subagent roles, scoped responsibilities, runtime state machine, milestone/task planning, review/QA loops, git checkpoint rules, and .codex/runtime initialization or maintenance.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Build Team
|
|
7
|
+
|
|
8
|
+
## Purpose
|
|
9
|
+
|
|
10
|
+
Create a repeatable Agent Team operating system for the current repository. Treat `CONTENT` from `/ow:team CONTENT` as the user's seed intent, then derive the team from the actual repo instead of copying a fixed roster blindly.
|
|
11
|
+
|
|
12
|
+
The final team must include:
|
|
13
|
+
|
|
14
|
+
- an `AGENT.md` project guide or an equivalent update to the existing guide
|
|
15
|
+
- `.codex/agents/` role documents for the orchestrator and selected subagents
|
|
16
|
+
- `.codex/runtime/` initialized with scopes, milestones, tasks, prompts, reviews, issues, and archive folders
|
|
17
|
+
- `.codex/runtime/scopes/<scope_id>/AGENT_ROSTER.yaml` for persistent and event-driven agent lifecycle tracking
|
|
18
|
+
- a state machine that binds planning, implementation, review, QA, fixes, checkpoint commits, and archiving
|
|
19
|
+
|
|
20
|
+
## Required Repo Scan
|
|
21
|
+
|
|
22
|
+
Before asking the user anything, inspect the repo state and infer the project goal.
|
|
23
|
+
|
|
24
|
+
Run or equivalent:
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
pwd
|
|
28
|
+
git status --short
|
|
29
|
+
git branch --show-current
|
|
30
|
+
git log --oneline -5
|
|
31
|
+
rg --files -g '!node_modules' -g '!dist' -g '!build' -g '!coverage'
|
|
32
|
+
rg -n "goal|scope|mvp|roadmap|milestone|agent|runtime|architecture|launch|todo|spec" .
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
Read the relevant files from this scan, prioritizing:
|
|
36
|
+
|
|
37
|
+
- `AGENT.md`, `.codex/agents/README.md`, `.codex/runtime/**`
|
|
38
|
+
- `README*`, `docs/**`, `DESIGN_SPEC/**`, `SPEC*`, `ROADMAP*`, `LAUNCH_CHECKLIST*`
|
|
39
|
+
- package or framework manifests such as `package.json`, `pyproject.toml`, `Cargo.toml`, `go.mod`
|
|
40
|
+
- existing tests and CI files
|
|
41
|
+
|
|
42
|
+
Summarize internally:
|
|
43
|
+
|
|
44
|
+
- current repo goal and current delivery stage
|
|
45
|
+
- source-of-truth documents
|
|
46
|
+
- application roots and ownership boundaries
|
|
47
|
+
- existing workflow artifacts that must be preserved
|
|
48
|
+
- dirty worktree changes that must not be overwritten
|
|
49
|
+
|
|
50
|
+
## Ask Exactly One Question
|
|
51
|
+
|
|
52
|
+
After the repo scan, ask one question and only one question before designing the team. The question must compress all missing high-value slots into a single prompt.
|
|
53
|
+
|
|
54
|
+
Use this shape:
|
|
55
|
+
|
|
56
|
+
```txt
|
|
57
|
+
I infer this repo is aiming at <repo_goal>. For this /ow:team run, what delivery target should the team optimize for, what counts as done for the first milestone, and are there any agent roles/tools that must be included or forbidden?
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
Parameter slots filled by the answer:
|
|
61
|
+
|
|
62
|
+
- `delivery_target`
|
|
63
|
+
- `first_milestone_done_criteria`
|
|
64
|
+
- `required_roles`
|
|
65
|
+
- `forbidden_roles_or_tools`
|
|
66
|
+
- `scope_id` if the user names one
|
|
67
|
+
- `validation_bar`
|
|
68
|
+
|
|
69
|
+
Do not ask follow-up questions. If the answer is incomplete, state assumptions and proceed.
|
|
70
|
+
|
|
71
|
+
## Design Workflow
|
|
72
|
+
|
|
73
|
+
Once the scan and the single answer are complete, plan the build in dependency order.
|
|
74
|
+
|
|
75
|
+
1. Define the scope.
|
|
76
|
+
- Choose a stable `scope_id`, usually `MVP`, `V1`, `MIGRATION`, or a short uppercase slug.
|
|
77
|
+
- Identify source-of-truth artifacts and non-goals.
|
|
78
|
+
- Define application roots and protected roots.
|
|
79
|
+
|
|
80
|
+
2. Select the team.
|
|
81
|
+
- Always include `orchestrator`.
|
|
82
|
+
- Include implementation agents only for real repo domains, such as frontend, backend, content-schema, data, infra, docs, or testing.
|
|
83
|
+
- Include `tech-prompt-agent` when tasks need formal prompts before implementation.
|
|
84
|
+
- Include `tdd-qa-agent` for executable checks and milestone QA.
|
|
85
|
+
- Include `code-review-agent` for async artifact review.
|
|
86
|
+
- Include `security-review-agent` only when the repo handles secrets, auth, deployment, external input, APIs, dependencies, or infrastructure.
|
|
87
|
+
- Include `git-release-agent` when milestone branches, commits, PRs, or releases are part of the workflow.
|
|
88
|
+
|
|
89
|
+
3. Define role boundaries.
|
|
90
|
+
- Orchestrator owns runtime state, task transitions, integration, and git checkpoint decisions.
|
|
91
|
+
- Orchestrator uses delegation-first execution: it must assign or resume an eligible subagent before doing implementation, docs, QA, review, or prompt-writing work directly.
|
|
92
|
+
- Direct Orchestrator execution requires an `orchestrator_exception` note in the task state.
|
|
93
|
+
- Implementation agents edit only their `owned_paths` and never commit.
|
|
94
|
+
- Review and security agents write review artifacts and issue logs; they do not edit implementation files.
|
|
95
|
+
- QA agents may write tests and QA reports; they do not commit.
|
|
96
|
+
- Git release agents draft branch, commit, PR, and release text; final git actions remain with the Orchestrator unless the user explicitly changes that boundary.
|
|
97
|
+
|
|
98
|
+
4. Define agent session topology.
|
|
99
|
+
- Persistent agents stay mounted across related atom tasks and issue-fix loops.
|
|
100
|
+
- Use persistent agents for planning and recurring implementation domains such as frontend, backend, content/schema, data, docs, or infra.
|
|
101
|
+
- Event-driven agents run asynchronously or one-off, then close after handoff.
|
|
102
|
+
- Use event-driven agents for code review, security review, milestone QA, git release drafting, and narrow investigations.
|
|
103
|
+
- Require the Orchestrator to capture every returned `agent_id` after spawn or resume and write it to `AGENT_ROSTER.yaml` and the task entry.
|
|
104
|
+
- Do not leave `agent_id: null` after assignment. Use `legacy_untracked` only for historical tasks that predate roster tracking.
|
|
105
|
+
|
|
106
|
+
5. Define milestones.
|
|
107
|
+
- Convert the repo goal into dependency-ordered milestones.
|
|
108
|
+
- Keep contracts before broad implementation.
|
|
109
|
+
- Each milestone needs source artifacts, expected artifacts, dependencies, QA gate, acceptance criteria, and estimated atom task range.
|
|
110
|
+
|
|
111
|
+
6. Define atom task schema.
|
|
112
|
+
- Make tasks small enough for one agent and one ownership boundary.
|
|
113
|
+
- Require `agent_session_policy`, `agent_id`, `preferred_agent_id`, `assigned_at`, `resumed_from_agent_id`, `handoff_required`, `orchestrator_exception`, `status`, `artifact_status`, `review_status`, `qa_status`, `is_output_done`, dependencies, `owned_paths`, `allowed_paths`, checks, and prompt path.
|
|
114
|
+
- Do not treat file existence as completion.
|
|
115
|
+
|
|
116
|
+
7. Initialize or reconcile `.codex/runtime/`.
|
|
117
|
+
- Use `scripts/init_team_runtime.py` for the base directory and YAML skeleton when possible.
|
|
118
|
+
- Preserve existing runtime files unless the user explicitly asks to regenerate.
|
|
119
|
+
- Add missing archive folders even when runtime state already exists.
|
|
120
|
+
|
|
121
|
+
8. Write or update coordination artifacts.
|
|
122
|
+
- `AGENT.md`
|
|
123
|
+
- `.codex/agents/README.md`
|
|
124
|
+
- `.codex/agents/<role>.md`
|
|
125
|
+
- `.codex/runtime/**`
|
|
126
|
+
|
|
127
|
+
9. Validate.
|
|
128
|
+
- Ensure all YAML is parseable or structurally consistent.
|
|
129
|
+
- Ensure every referenced prompt/review/task path has a parent directory.
|
|
130
|
+
- Ensure role docs declare `can_modify_code`, `can_commit`, `owns`, `forbidden_paths`, inputs, and outputs.
|
|
131
|
+
- Ensure every newly assigned task has a non-null `agent_id`.
|
|
132
|
+
- Check `git status --short` and report created or changed files.
|
|
133
|
+
|
|
134
|
+
## Runtime Initialization
|
|
135
|
+
|
|
136
|
+
The runtime root must be:
|
|
137
|
+
|
|
138
|
+
```txt
|
|
139
|
+
.codex/runtime/
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
Required hierarchy:
|
|
143
|
+
|
|
144
|
+
```txt
|
|
145
|
+
.codex/runtime/
|
|
146
|
+
RUNTIME_INDEX.yaml
|
|
147
|
+
STATE_MACHINE.md
|
|
148
|
+
archive/
|
|
149
|
+
scopes/
|
|
150
|
+
<scope_id>/
|
|
151
|
+
SCOPE.yaml
|
|
152
|
+
MILESTONES.yaml
|
|
153
|
+
IMPLEMENT_INDEX.yaml
|
|
154
|
+
IMPLEMENT_ISSUE_INDEX.yaml
|
|
155
|
+
AGENT_ROSTER.yaml
|
|
156
|
+
archive/
|
|
157
|
+
milestones/
|
|
158
|
+
<milestone_id>/
|
|
159
|
+
IMPLEMENT_TASKS.yaml
|
|
160
|
+
IMPLEMENT_ISSUES.yaml
|
|
161
|
+
prompts/
|
|
162
|
+
reviews/
|
|
163
|
+
archive/
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
Use `archive/` for superseded plans, stale prompts, obsolete reviews, replaced QA evidence, and frozen milestone snapshots. Do not delete historical coordination artifacts unless the user explicitly requests cleanup.
|
|
167
|
+
|
|
168
|
+
Run the helper from the repo root, adapting arguments to the planned scope:
|
|
169
|
+
|
|
170
|
+
```bash
|
|
171
|
+
python3 .codex/skills/build-team/scripts/init_team_runtime.py \
|
|
172
|
+
--scope-id MVP \
|
|
173
|
+
--scope-title "MVP implementation" \
|
|
174
|
+
--source-artifact AGENT.md \
|
|
175
|
+
--milestone "M01:Repo initialization"
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
If this skill is installed outside the repo, run the script from the skill folder path instead.
|
|
179
|
+
|
|
180
|
+
## Agent Session Topology
|
|
181
|
+
|
|
182
|
+
Persistent agents:
|
|
183
|
+
|
|
184
|
+
- Use for recurring planning and implementation work.
|
|
185
|
+
- Keep mounted while the milestone or related issue-fix loop is active.
|
|
186
|
+
- Resume the same `agent_id` for related atom tasks before spawning a replacement.
|
|
187
|
+
- Send review-discovered fix tasks back to the original persistent implementation agent when ownership still matches.
|
|
188
|
+
|
|
189
|
+
Event-driven agents:
|
|
190
|
+
|
|
191
|
+
- Use for async code review, security review, milestone QA, git release drafting, and one-off investigations.
|
|
192
|
+
- Allow event-driven review to run against an earlier milestone while persistent implementation agents continue later work, as long as ownership is disjoint.
|
|
193
|
+
- Close event-driven agents after handoff unless the Orchestrator records a reason to keep them idle.
|
|
194
|
+
|
|
195
|
+
The Orchestrator must immediately write every returned subagent `agent_id` to both:
|
|
196
|
+
|
|
197
|
+
```txt
|
|
198
|
+
.codex/runtime/scopes/<scope_id>/AGENT_ROSTER.yaml
|
|
199
|
+
.codex/runtime/scopes/<scope_id>/milestones/<milestone_id>/IMPLEMENT_TASKS.yaml
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
New assigned work must not keep `agent_id: null`.
|
|
203
|
+
|
|
204
|
+
## State Machine
|
|
205
|
+
|
|
206
|
+
Use this operating flow:
|
|
207
|
+
|
|
208
|
+
```txt
|
|
209
|
+
repo_scan
|
|
210
|
+
-> user_parameter_question
|
|
211
|
+
-> scope_design
|
|
212
|
+
-> runtime_bootstrap
|
|
213
|
+
-> milestone_plan
|
|
214
|
+
-> atom_task_plan
|
|
215
|
+
-> agent_session_topology
|
|
216
|
+
-> prompt_preparation
|
|
217
|
+
-> spawn_or_resume_agent
|
|
218
|
+
-> record_agent_id
|
|
219
|
+
-> implementation_or_event_work
|
|
220
|
+
-> artifact_ready
|
|
221
|
+
-> async_review
|
|
222
|
+
-> issue_fix_loop
|
|
223
|
+
-> resume_original_persistent_agent_for_fix
|
|
224
|
+
-> milestone_qa
|
|
225
|
+
-> git_checkpoint_decision
|
|
226
|
+
-> archive_or_freeze
|
|
227
|
+
-> next_milestone
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
Allowed task `status` values:
|
|
231
|
+
|
|
232
|
+
```txt
|
|
233
|
+
planned
|
|
234
|
+
prompted
|
|
235
|
+
claimed
|
|
236
|
+
in_progress
|
|
237
|
+
artifact_ready
|
|
238
|
+
review_pending
|
|
239
|
+
reviewed
|
|
240
|
+
fix_required
|
|
241
|
+
qa_ready
|
|
242
|
+
done
|
|
243
|
+
blocked
|
|
244
|
+
archived
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
Allowed `artifact_status` values:
|
|
248
|
+
|
|
249
|
+
```txt
|
|
250
|
+
missing
|
|
251
|
+
created
|
|
252
|
+
validated
|
|
253
|
+
archived
|
|
254
|
+
```
|
|
255
|
+
|
|
256
|
+
Allowed `review_status` values:
|
|
257
|
+
|
|
258
|
+
```txt
|
|
259
|
+
none
|
|
260
|
+
pending
|
|
261
|
+
passed
|
|
262
|
+
issues_found
|
|
263
|
+
waived
|
|
264
|
+
```
|
|
265
|
+
|
|
266
|
+
Allowed `qa_status` values:
|
|
267
|
+
|
|
268
|
+
```txt
|
|
269
|
+
not_run
|
|
270
|
+
passed
|
|
271
|
+
failed
|
|
272
|
+
waived
|
|
273
|
+
```
|
|
274
|
+
|
|
275
|
+
Allowed milestone `status` values:
|
|
276
|
+
|
|
277
|
+
```txt
|
|
278
|
+
planned
|
|
279
|
+
active
|
|
280
|
+
qa
|
|
281
|
+
completed
|
|
282
|
+
frozen
|
|
283
|
+
blocked
|
|
284
|
+
deferred
|
|
285
|
+
archived
|
|
286
|
+
```
|
|
287
|
+
|
|
288
|
+
## References
|
|
289
|
+
|
|
290
|
+
Load `references/team-protocol.md` before writing `AGENT.md` or `.codex/agents/*.md`.
|
|
291
|
+
|
|
292
|
+
Load `references/runtime-schema.md` before writing or reconciling `.codex/runtime/**`.
|