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
100 changes: 100 additions & 0 deletions .github/workflows/code-review.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ jobs:
env:
BASE_BRANCH: ${{ github.event.pull_request.base.ref }}
run: |
set -euo pipefail

codex exec \
--sandbox read-only \
--json \
Expand All @@ -51,6 +53,56 @@ jobs:
--base "${BASE_BRANCH}" \
> codex-review.jsonl

if [ -s codex-review.md ]; then
exit 0
fi

echo "codex-review.md is empty; attempting JSONL fallback."
node <<'NODE'
const fs = require("node:fs");

const outputPath = "codex-review.md";
const jsonlPath = "codex-review.jsonl";

if (!fs.existsSync(jsonlPath)) {
process.exit(0);
}

let lastAgentMessage = "";
const lines = fs.readFileSync(jsonlPath, "utf8").split(/\r?\n/);
for (const line of lines) {
if (!line.trim()) {
continue;
}

try {
const event = JSON.parse(line);
if (event?.type !== "item.completed") {
continue;
}
if (event?.item?.type !== "agent_message") {
continue;
}

const text = `${event?.item?.text ?? ""}`.trim();
if (text) {
lastAgentMessage = text;
}
} catch {
// Ignore malformed JSONL lines and keep searching for valid events.
}
}

if (lastAgentMessage) {
fs.writeFileSync(outputPath, `${lastAgentMessage}\n`, "utf8");
}
NODE

if [ ! -s codex-review.md ]; then
echo "Codex review produced no final message in codex-review.md or codex-review.jsonl." >&2
exit 1
fi

- name: Post inline PR comments
uses: actions/github-script@v7
env:
Expand All @@ -63,6 +115,8 @@ jobs:
const path = require("node:path");

const MARKER = "<!-- codex-inline-review -->";
const OVERALL_MARKER = "<!-- codex-overall-review -->";
const MAX_REVIEW_COMMENT_CHARS = 60000;
const REVIEW_FILE = process.env.REVIEW_FILE || "codex-review.md";
const OUTPUT_JSONL = process.env.OUTPUT_JSONL || "codex-review.jsonl";
const workspace = (process.env.GITHUB_WORKSPACE || "").replace(/\\/g, "/");
Expand Down Expand Up @@ -142,11 +196,57 @@ jobs:
return findings;
}

async function upsertOverallReviewComment(text) {
const trimmedReview = text.trim();
const reviewBody = trimmedReview
? trimmedReview.length > MAX_REVIEW_COMMENT_CHARS
? `${trimmedReview.slice(0, MAX_REVIEW_COMMENT_CHARS)}\n\n_(Review text truncated for GitHub comment limits.)_`
: trimmedReview
: "_Codex produced no review text._";

const overallBody = [
OVERALL_MARKER,
"",
reviewBody,
"",
`Raw outputs: ${REVIEW_FILE}, ${OUTPUT_JSONL}`,
].join("\n");

const issueComments = await github.paginate(
github.rest.issues.listComments,
{ owner, repo, issue_number: pullNumber, per_page: 100 }
);
const existingOverall = issueComments.find(
(comment) =>
comment.user?.login === "github-actions[bot]" &&
typeof comment.body === "string" &&
comment.body.includes(OVERALL_MARKER)
);

if (existingOverall) {
await github.rest.issues.updateComment({
owner,
repo,
comment_id: existingOverall.id,
body: overallBody,
});
} else {
await github.rest.issues.createComment({
owner,
repo,
issue_number: pullNumber,
body: overallBody,
});
}
}

const reviewText = fs.readFileSync(REVIEW_FILE, "utf8");
await upsertOverallReviewComment(reviewText);
const findings = parseFindings(reviewText);

if (!findings.length) {
core.info("No line-addressable findings were parsed from Codex output.");

return;
}

Expand Down
2 changes: 1 addition & 1 deletion ARCHITECTURE.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ Groundwork ships skills from two maintenance locations, but inventory is unified

Skills maintained in this repository are listed in `skills/skills.toml` with local paths under `skills/`. These skills define the pipeline's structure — what stages exist, what handoff contracts connect them, and what cognitive discipline the pipeline enforces.

Skills maintained upstream (from [obra/superpowers](https://github.com/obra/superpowers)) are listed in the same manifest with pinned commits and fetched at install time. They fill the execution phase — TDD, debugging, subagent orchestration, code review, verification — where high-quality implementations already exist.
Skills maintained upstream (from [obra/superpowers](https://github.com/obra/superpowers)) are listed in the same manifest with pinned commits and fetched at install time. They fill the execution phase — debugging and subagent orchestration — where high-quality implementations already exist.

Curated skills are pinned to a specific commit. They are not forked, vendored, or modified. Integration happens through documentation: WORKFLOW.md defines handoff rules that connect curated skills to the pipeline's input/output contracts.

Expand Down
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).

- Five-stage methodology pipeline: frame constraints, define behavior, decompose, execute and verify, land
- Ten core skills: `ground`, `research`, `bdd`, `issue-craft`, `begin`, `plan`, `test-first`, `documentation`, `land`, and `using-groundwork` (methodology orientation)
- Five curated skills from [obra/superpowers](https://github.com/obra/superpowers): `subagent-driven-development`, `systematic-debugging`, `verification-before-completion`, `requesting-code-review`, `receiving-code-review`
- Two curated skills from [obra/superpowers](https://github.com/obra/superpowers): `subagent-driven-development`, `systematic-debugging`
- Rust CLI (`groundwork init`, `update`, `list`, `doctor`) with curated manifest and `sk` integration
- Automatic `gh-issue-sync` installation during `groundwork init`
- Schema distribution in CLI: `init/update` now provision `.groundwork/schemas/`, create `.groundwork/artifacts/`, and `doctor` reports schema completeness/drift
Expand All @@ -22,6 +22,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).

### Changed

- Replaced curated `verification-before-completion` (obra/superpowers) with groundwork-native original (v1.0.0). Preserves core discipline (Iron Law, gate function, common-failures table, anti-rationalization patterns, red flags). Adds Lifecycle Role section establishing pipeline position, Corruption Modes section, and cross-references. Removes superpowers-specific vocabulary.
- Documented upstream attribution convention in CONTRIBUTING.md: LICENSE-UPSTREAM requirements for adapted skills, origin metadata standard, curated-skills attribution reasoning, and attribution checklist at the skill-authoring boundary
- Replaced curated `test-driven-development` (obra/superpowers) with groundwork-native `test-first` skill (v1.0.0). Preserves core discipline (Iron Law, red-green-refactor, delete-and-start-over, anti-rationalization patterns) while adding bidirectional composition with `bdd`, `verification-before-completion`, `systematic-debugging`, and `documentation`. Lifecycle Role section establishes pipeline position. Corruption Modes section added. Language-agnostic examples replace TypeScript-only. Companion `testing-anti-patterns.md` migrated to `references/`.
- `ground` skill upgraded to v3.0.0: broadened from design-only to full first-principles cognitive discipline covering strategic analysis, cost decomposition, and problem reframing. Added Active Excavation section (Socratic Drilling, Recursive Why). Decompose step now supports three modes (requirements, constituent, process) with Orient determining which applies. Orient step broadened with mode-specific questions. New "Structure survey as analysis" corruption mode. All existing patterns and corruption modes retained.
Expand Down
2 changes: 1 addition & 1 deletion agents.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ third_force = { gh = "pentaxis93/groundwork", path = "skills/third-force" }
subagent_driven_development = { gh = "obra/superpowers", path = "skills/subagent-driven-development", rev = "e4a2375cb705ca5800f0833528ce36a3faf9017a" }
test_first = { gh = "pentaxis93/groundwork", path = "skills/test-first" }
systematic_debugging = { gh = "obra/superpowers", path = "skills/systematic-debugging", rev = "e4a2375cb705ca5800f0833528ce36a3faf9017a" }
verification_before_completion = { gh = "obra/superpowers", path = "skills/verification-before-completion", rev = "e4a2375cb705ca5800f0833528ce36a3faf9017a" }
verification_before_completion = { gh = "pentaxis93/groundwork", path = "skills/verification-before-completion" }
1 change: 1 addition & 0 deletions crates/groundwork-cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1951,6 +1951,7 @@ mod tests {
"skills/test-first",
"skills/third-force",
"skills/documentation",
"skills/verification-before-completion",
"skills/propose",
"skills/land",
]
Expand Down
2 changes: 1 addition & 1 deletion docs/architecture/pipeline-contract.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Groundwork has one coherent path:
1. `ground` frames constraints.
2. `bdd` defines and maintains behavior contract.
3. `plan` converges from exploration to a decision-complete implementation design. `issue-craft` decomposes that design into agent-executable issues. `begin` initiates the work session: selects session-sized work, prepares the workspace, and declares direction.
4. Curated middle skills implement and verify the same behavior contract.
4. Middle skills implement and verify the same behavior contract.
5. `land` closes work with behavior coverage visibility.

`bdd` and `test-first` are not alternatives.
Expand Down
3 changes: 1 addition & 2 deletions skills/skills.toml
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,7 @@ use_when = "Use when documentation may drift or when a decision or behavior chan
name = "verification-before-completion"
path = "skills/verification-before-completion"
provider = "gh"
repo = "obra/superpowers"
rev = "e4a2375cb705ca5800f0833528ce36a3faf9017a"
repo = "pentaxis93/groundwork"
use_when = "Use before claiming work is complete, fixed, or passing."

[[skills]]
Expand Down
35 changes: 35 additions & 0 deletions skills/verification-before-completion/LICENSE-UPSTREAM
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
This skill is adapted from the verification-before-completion skill in
obra/superpowers (https://github.com/obra/superpowers), pinned at commit
e4a2375. The original skill is licensed under the MIT License reproduced
below.

Substantial portions of the original are preserved in this adaptation: the
Iron Law, the gate function (identify → run → read → verify → claim), the
common-failures table, the rationalization prevention table, the red flags
list, and the key verification patterns. These have been adapted with
vocabulary normalization and structural additions (lifecycle role,
corruption modes, cross-references).

---

MIT License

Copyright (c) 2025 Jesse Vincent

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Loading