Skip to content

Adjust-existing-card flow for factory:go (seed-from-source + adjustment issues)#5145

Open
jurgenwerk wants to merge 8 commits into
mainfrom
cs-11424-improve-existing-card-flow-for-factorygo-seed-from-source
Open

Adjust-existing-card flow for factory:go (seed-from-source + adjustment issues)#5145
jurgenwerk wants to merge 8 commits into
mainfrom
cs-11424-improve-existing-card-flow-for-factorygo-seed-from-source

Conversation

@jurgenwerk

@jurgenwerk jurgenwerk commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

What this is

Teaches factory:go to adjust an existing card instead of only generating new ones. When the brief carries a sourceCardUrl, the factory seeds the new realm with a working copy of that card and its dependency graph, confirms a green baseline, then runs the standard issue loop — where the issues describe adjustments (deltas) to the seeded card. No sourceCardUrl → greenfield, exactly as before. Run inputs stay 2-input (brief URL + new realm URL).

What's in here

  • Brief schema — optional sourceCardUrl on the brief card; present → adjust flow, absent → greenfield.
  • adjustment issue type — alongside bootstrap / feature.
  • Seed branching (factory-seed.ts) — when sourceCardUrl is set, the bootstrap issue carries adjust instructions: seed the source card + its dependency graph, confirm a green baseline, write a source-provenance article, and create adjustment issues. Source cards with no co-located tests get characterization tests first, so there's a baseline to protect.
  • Orchestrator skills — bootstrap gets an "Adjust flow" section; operations gets an "Adjustment issues" section (edit the seeded files in place, keep the baseline tests passing).
  • Scheduler fix — the issue search now matches Issue cards whichever module they adopt, so issues a human adds through the board UI get picked up (previously invisible to the loop).
  • darkfactory re-exports the tracker card types instead of subclassing them, so factory-created and UI-created cards share one type identity.
  • Skill loader always loads software-factory-operations for non-bootstrap issues — sparse, human-written issues were silently skipping it.

Verified

Several factory:go runs against the catalog mortgage-calculator: seed → green baseline → adjustments applied, all five validators green — including a human-added board issue that got picked up and implemented after the scheduler + darkfactory fixes.

The dedicated boxel realm ingest-card command the seed step uses is in the stacked #5166 (based on this branch).

🤖 Generated with Claude Code

@github-actions

github-actions Bot commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

Preview deployments

Host Test Results

    1 files      1 suites   1h 36m 36s ⏱️
2 945 tests 2 930 ✅ 15 💤 0 ❌
2 964 runs  2 949 ✅ 15 💤 0 ❌

Results for commit a1089a9.

Realm Server Test Results

    1 files      1 suites   8m 24s ⏱️
1 544 tests 1 544 ✅ 0 💤 0 ❌
1 635 runs  1 635 ✅ 0 💤 0 ❌

Results for commit a1089a9.

When a brief carries a sourceCardUrl, factory:go seeds the target realm
from that existing card and its same-realm dependency graph, confirms a
green baseline (writing characterization tests when the source card has
none), then creates adjustment-type issues from the brief. Absent a
sourceCardUrl the run stays greenfield, unchanged.

- realm/wiki.gts: optional sourceCardUrl field on the brief card
- realm/kanban-config.gts: adjustment issueType
- src/factory-brief.ts: read sourceCardUrl onto FactoryBrief
- src/factory-seed.ts: branch the bootstrap-seed issue on sourceCardUrl
- skills-orchestrator bootstrap/operations: improve + adjustment guidance
- docs/improve-existing-card-flow.md: contract design note
- realm/Wiki/improve-mortgage-extra-payment.json: test brief fixture
- tests/factory-brief.test.ts: sourceCardUrl parsing

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@jurgenwerk jurgenwerk force-pushed the cs-11424-improve-existing-card-flow-for-factorygo-seed-from-source branch from a1089a9 to 101797a Compare June 8, 2026 12:16
jurgenwerk and others added 4 commits June 9, 2026 12:20
The `Issue` class is defined in `issue-tracker` and re-exported by
`darkfactory`. Factory-written issues adopt `darkfactory#Issue`; an issue a
human adds through the IssueTracker board adopts the canonical
`issue-tracker#Issue`. The scheduler's issue search filtered on
`darkfactory#Issue` only, so board-added (human-in-the-loop) issues were
invisible — the loop loaded just the factory issues and exited
`no_unblocked_issues`.

RealmIssueStore.listIssues / refreshIssue now match `Issue` from either
module via an `any` type filter.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
darkfactory.gts exported Issue / Project / IssueTracker as empty subclasses
of the canonical issue-tracker definitions, which forked the card type
identity: factory-written cards adopt darkfactory#Issue while cards added via
the IssueTracker board UI adopt issue-tracker#Issue, so a type filter on one
didn't match the other — human-added issues were invisible to the scheduler.
Re-export the same classes so darkfactory#Issue === issue-tracker#Issue.

Pairs with the scheduler's any-of-both-modules filter (which keeps the loop
working on already-indexed realms until they reindex against the new module).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The skill loader gated `software-factory-operations` on workflow keywords
in the issue text. Sparse, human-authored issues added via the board UI
(e.g. a one-line "Modernize the look" adjustment) didn't match, so the
agent ran without the edit-in-place / guard-the-baseline guidance — it
only succeeded on the model's own judgment. Every non-bootstrap issue is a
factory delivery issue, so load operations unconditionally.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Standardize the flow's wording on "adjust" (matching the `adjustment`
issueType) across code, skills, the design note, and the test brief —
comments, strings, the seed "Mode: ADJUST EXISTING CARD" label,
adjustSeedInstructions, the bootstrap "Adjust flow" section. Renamed
docs/improve-existing-card-flow.md → adjust-existing-card-flow.md and the
brief fixture → adjust-mortgage-extra-payment.json. The Linear project's
proper-name reference is left intact.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@jurgenwerk jurgenwerk changed the title Improve-existing-card flow for factory:go (seed-from-source + adjustment issues) Adjust-existing-card flow for factory:go (seed-from-source + adjustment issues) Jun 9, 2026
jurgenwerk and others added 2 commits June 9, 2026 14:39
The note was framed as a pre-implementation design ticket whose breakdown
(CS-11399–CS-11407) "builds on" it — but that breakdown is mostly canceled
and the code shipped in this PR. Removed the reference-map table, the
"no code ships from this ticket" status framing, and the inline CS-#### tags
throughout, so the note just describes the contract. Also fixed a stray
"improving" → "adjusting" in the seed instructions.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
- Remove realm/Wiki/adjust-mortgage-extra-payment.json (test brief — not
  needed in the PR).
- Shorten the darkfactory re-export comment to the essential rationale.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR extends the software-factory “factory:go” workflow to support an adjust-existing-card mode driven by a brief’s optional sourceCardUrl, adds an adjustment issue type, and fixes issue discovery/skill loading so human-created board issues participate in the scheduling loop.

Changes:

  • Add sourceCardUrl to the brief contract (Wiki card + brief normalization) and update seed/bootstrap guidance to branch into an “adjust existing card” flow.
  • Add adjustment as a first-class issueType option and document the adjust flow contract.
  • Fix scheduler issue discovery to match Issue cards from both darkfactory and issue-tracker, and ensure non-bootstrap issues always load software-factory-operations.

Reviewed changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
packages/software-factory/src/factory-brief.ts Extends brief normalization to read optional sourceCardUrl.
packages/software-factory/tests/factory-brief.test.ts Adds tests for sourceCardUrl present/absent normalization behavior.
packages/software-factory/src/factory-seed.ts Branches bootstrap seed issue instructions for greenfield vs adjust flows.
packages/software-factory/.agents/skills-orchestrator/software-factory-bootstrap/SKILL.md Documents greenfield vs adjust bootstrap responsibilities and steps.
packages/software-factory/.agents/skills-orchestrator/software-factory-operations/SKILL.md Adds operational guidance specific to adjustment issues (edit-in-place + baseline protection).
packages/software-factory/realm/wiki.gts Adds sourceCardUrl field to the Wiki card used as a factory brief.
packages/software-factory/realm/kanban-config.gts Adds adjustment to issueTypeOptions.
packages/software-factory/realm/darkfactory.gts Re-exports tracker card types to avoid subclass type-identity divergence.
packages/software-factory/src/issue-scheduler.ts Updates RealmIssueStore filtering to match Issue cards from both modules.
packages/software-factory/tests/issue-scheduler.test.ts Adds regression test asserting the scheduler queries both Issue module URLs.
packages/software-factory/src/factory-skill-loader.ts Always includes software-factory-operations for non-bootstrap issues.
packages/software-factory/tests/factory-skill-loader.test.ts Adds/updates tests to reflect operations skill always loading.
packages/software-factory/docs/adjust-existing-card-flow.md New design/contract doc for the adjust-existing-card flow and brief schema.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread packages/software-factory/src/factory-skill-loader.ts Outdated
Comment thread packages/software-factory/src/issue-scheduler.ts Outdated
Comment thread packages/software-factory/docs/adjust-existing-card-flow.md Outdated
- factory-skill-loader: drop the dangling FACTORY_WORKFLOW_KEYWORDS doc
  comment left after the keyword list was removed.
- issue-scheduler: derive the issue-tracker module URL by swapping the final
  path segment after trimming trailing slashes, so it's robust to a trailing
  slash / equivalent canonicalization of darkfactoryModuleUrl.
- design note: reword the same-server "cost" bullet — it's a procedural
  assumption (a cross-server URL just fails to fetch), not a code-enforced
  origin rejection.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@jurgenwerk jurgenwerk marked this pull request as ready for review June 9, 2026 13:17
@jurgenwerk jurgenwerk requested a review from a team June 9, 2026 13:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants