Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: CI

on:
pull_request:
push:
branches: [main]

permissions:
contents: read

jobs:
verify:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
- uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5
with:
python-version: "3.11"
- run: ./scripts/verify-outcome.sh
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,5 @@ build/
local.properties
*.keystore
*.jks
__pycache__/
*.py[cod]
1 change: 1 addition & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
MIT License

Copyright (c) 2026 BeFeast
Copyright (c) 2026 Matt Pocock

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
26 changes: 26 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,29 @@
Native interactive questionnaire rounds replace Markdown-only grilling while preserving the complete linked grill-me -> grilling flow across Codex, Claude Code, and OpenCode.

Project: `BeFeast/dev-workflow`.

The first supported harness is Codex. Its committed bundle lives under
`harnesses/codex/`; `grill-me` remains a user-invoked wrapper over the reusable
model-invoked `grilling` primitive. The canonical frontier-round behavior is
defined in `contracts/grilling-v1.md` and enforced by the Python fixtures.

Run the complete repository gate with:

```sh
./scripts/verify-outcome.sh
```

The canonical single-path skill installer does not consume this repository's
`bundle.json`, so selecting only its `grill-me` path would omit `grilling` and
the upstream notice. Materialize a dependency-complete portable selection with
the repository selector instead:

```sh
python3 scripts/select_codex_skills.py \
--skill grill-me \
--target /tmp/dev-workflow-codex-selection
```

The target must be empty. This command is safe for isolated inspection and
fixture roots; live harness installation remains a separate approval-gated
delivery step.
51 changes: 51 additions & 0 deletions contracts/grilling-v1.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# Grilling contract v1

`grilling` is the model-invoked primitive. `grill-me` is a user-invoked wrapper
that delegates to it; callers must not copy or fork the interview logic.

## Design tree

- A decision has a stable `snake_case` id, prompt, choices, recommendation,
decision prerequisites, and optional discoverable-fact prerequisites.
- Resolve facts from the environment before asking the user. Facts do not
become user decisions.
- The frontier contains every unresolved decision whose decision and fact
prerequisites are settled.
- Preserve source order inside a frontier so generated calls and fixtures are
deterministic.

## Frontier round

1. Snapshot the complete frontier before invoking a harness tool.
2. Partition that immutable snapshot only when the harness limits one call.
3. Collect and normalize every answer from every partition, including custom
`Other` values and notes appended to a selected option. Discard a native
`Other` sentinel, never the user's free-form text.
4. Commit only the complete snapshot. Never expose decisions unblocked by a
partial partition.
5. Recompute the frontier and repeat.

The session ends only after every known decision is settled and the user
confirms shared understanding through the same interaction surface. A frontier
temporarily empty because facts are still being resolved is not completion. A
rejection or custom concern extends the tree. Do not implement the grilled plan
before confirmation.

## Adapter seam

An adapter may only:

- detect whether its real native questionnaire tool is callable in the active
harness and mode;
- serialize a frontier snapshot within that tool's schema and call limits;
- normalize native and custom answers into the canonical answer shape;
- state the unavailable capability and use the documented fallback.

The Codex adapter further constrains each native question prompt to one
sentence and each option description to one short sentence, regardless of the
more permissive prose shape in the upstream skill. Its two or three choices
must be mutually exclusive; this semantic requirement stays in the skill and
fixtures because a serializer cannot infer exclusivity from arbitrary prose.

An adapter must not invent a neutral tool name, change the frontier, answer for
the user, silently claim native interaction, or recompute between chunks.
21 changes: 21 additions & 0 deletions dev_workflow/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
"""Shared contracts for generated multi-harness workflow skills."""

from .grilling import (
Answer,
Decision,
DesignTree,
InterviewState,
Option,
Question,
RoundSnapshot,
)

__all__ = [
"Answer",
"Decision",
"DesignTree",
"InterviewState",
"Option",
"Question",
"RoundSnapshot",
]
78 changes: 78 additions & 0 deletions dev_workflow/bundle.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
"""Dependency-aware selective materialization for the Codex bundle."""

from __future__ import annotations

import json
import shutil
from pathlib import Path


def resolve_skills(manifest: dict, selected: list[str]) -> tuple[str, ...]:
skills = manifest.get("skills")
if not isinstance(skills, dict):
raise ValueError("bundle manifest must define skills")
resolved: list[str] = []
visiting: set[str] = set()

def add(name: str) -> None:
if name in resolved:
return
if name in visiting:
raise ValueError("skill dependency cycle")
if name not in skills:
raise ValueError(f"unknown skill {name!r}")
visiting.add(name)
dependencies = skills[name].get("requires")
if not isinstance(dependencies, list) or not all(
isinstance(item, str) for item in dependencies
):
raise ValueError(f"skill {name!r} has invalid requires")
for dependency in dependencies:
add(dependency)
visiting.remove(name)
resolved.append(name)

for skill in selected:
add(skill)
return tuple(resolved)


def materialize_selection(
bundle_root: Path, target_root: Path, selected: list[str]
) -> tuple[str, ...]:
"""Copy a complete portable selection into an empty isolated target.

The output is shaped like a Codex skill root, but issue #1 callers use only
temporary or otherwise isolated targets. Live installation remains a
separate approval-gated delivery concern.
"""

manifest = json.loads((bundle_root / "bundle.json").read_text(encoding="utf-8"))
resolved = resolve_skills(manifest, selected)
target_root.mkdir(parents=True, exist_ok=True)
if any(target_root.iterdir()):
raise FileExistsError(f"selection target must be empty: {target_root}")

for name in resolved:
relative = manifest["skills"][name]["path"]
source = bundle_root / relative
target = target_root / name
shutil.copytree(source, target)

selected_manifest = {
**{key: value for key, value in manifest.items() if key != "skills"},
"selected": selected,
"skills": {
name: {**manifest["skills"][name], "path": name}
for name in resolved
},
}
(target_root / "dev-workflow-bundle.json").write_text(
json.dumps(selected_manifest, indent=2, sort_keys=True) + "\n",
encoding="utf-8",
)
shutil.copyfile(
bundle_root / "UPSTREAM_LICENSE",
target_root / "dev-workflow-UPSTREAM_LICENSE",
)
return resolved
Loading
Loading