@really-knows-ai/foundry 2.3.0 → 2.3.2
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/CHANGELOG.md +23 -0
- package/README.md +330 -139
- package/docs/concepts.md +89 -26
- package/docs/getting-started.md +149 -40
- package/docs/work-spec.md +38 -24
- package/package.json +1 -1
- package/skills/add-appraiser/SKILL.md +8 -2
- package/skills/add-artefact-type/SKILL.md +8 -2
- package/skills/add-cycle/SKILL.md +8 -2
- package/skills/add-flow/SKILL.md +8 -2
- package/skills/add-law/SKILL.md +8 -2
- package/skills/flow/SKILL.md +7 -5
- package/skills/forge/SKILL.md +15 -5
package/skills/flow/SKILL.md
CHANGED
|
@@ -20,9 +20,10 @@ Before running this skill, verify that the `foundry/` directory exists in the pr
|
|
|
20
20
|
1. Call `foundry_config_flow` with the flow ID — get the flow definition
|
|
21
21
|
2. Call `foundry_git_branch` with the flow ID and a short description — create the work branch
|
|
22
22
|
3. Determine the starting cycle:
|
|
23
|
-
-
|
|
24
|
-
-
|
|
25
|
-
- If ambiguous, prompt the user to choose
|
|
23
|
+
- Any cycle listed in the flow can be the starting cycle. The flow's `starting-cycles` list is a hint for when the user's request is ambiguous.
|
|
24
|
+
- Map the user's goal to a cycle by matching the requested output (e.g. "write a short story from the tennis haiku" → `create-short-story`; "write a haiku" → `create-haiku`).
|
|
25
|
+
- If the goal is ambiguous, prompt the user to choose from the flow's cycles, defaulting the recommendation to entries in `starting-cycles`.
|
|
26
|
+
- A cycle whose `inputs` contract cannot be satisfied from files already on disk should not be chosen as the starting cycle. If no other cycle matches, inform the user which input types are missing and offer to run a cycle that produces them first.
|
|
26
27
|
4. Pre-check for an existing workfile (prevents silent data loss from an aborted prior session):
|
|
27
28
|
a. Call `foundry_workfile_get`.
|
|
28
29
|
b. If it returns `{error: ...}` (no WORK.md), proceed to step 5.
|
|
@@ -49,9 +50,10 @@ When a cycle completes (sort returns `done`):
|
|
|
49
50
|
- Check input contracts for each
|
|
50
51
|
- The user chooses which target to pursue (or which to pursue first)
|
|
51
52
|
5. Set up the next cycle:
|
|
52
|
-
- Call `foundry_workfile_delete` to clear the completed cycle's WORK.md
|
|
53
|
+
- Call `foundry_workfile_delete` to clear the completed cycle's WORK.md.
|
|
53
54
|
- Call `foundry_workfile_create` with **only** the flow ID, the next cycle ID, and the goal — do **not** pass `stages` or `maxIterations`. The orchestrate skill will detect `needsSetup` on its first call and bootstrap the rest of the frontmatter from the cycle definition.
|
|
54
|
-
-
|
|
55
|
+
- Do **not** register the completed cycle's output as an input to the next cycle. The output file is on disk and the next cycle's forge discovers it through the input type's `file-patterns` — see the forge skill's input-discovery protocol.
|
|
56
|
+
- Execute the cycle by invoking the orchestrate skill.
|
|
55
57
|
|
|
56
58
|
## Completing a flow
|
|
57
59
|
|
package/skills/forge/SKILL.md
CHANGED
|
@@ -30,7 +30,11 @@ Forge runs inside an enforced stage. Your **first** and **last** tool calls are
|
|
|
30
30
|
3. `foundry_config_cycle` — understand what to produce and what inputs are available.
|
|
31
31
|
4. `foundry_config_artefact_type` with the output type ID — get the artefact type definition, especially its `file-patterns`.
|
|
32
32
|
5. `foundry_config_laws` — get all applicable laws (global + type-specific).
|
|
33
|
-
6. If the cycle
|
|
33
|
+
6. If the cycle declares `inputs`, discover input files by filesystem scan:
|
|
34
|
+
- For each type listed in `inputs`, call `foundry_config_artefact_type` to get its `file-patterns`.
|
|
35
|
+
- Glob the working tree against those patterns to enumerate candidate input files.
|
|
36
|
+
- Read the goal (from `foundry_workfile_get`) and select the files that are relevant to this run. If the goal names specific files or slugs, use those; if it describes a category ("all the auth tests"), select the matching subset; if it's open-ended, you may consume all candidates or ask the user when the set is clearly ambiguous.
|
|
37
|
+
- Read the selected files for context.
|
|
34
38
|
7. Produce the artefact, respecting all applicable laws from the start.
|
|
35
39
|
8. Write the artefact file to a location that matches the artefact type's `file-patterns`.
|
|
36
40
|
9. `foundry_stage_end({summary})`.
|
|
@@ -40,16 +44,22 @@ Forge runs inside an enforced stage. Your **first** and **last** tool calls are
|
|
|
40
44
|
1. `foundry_stage_begin(...)`.
|
|
41
45
|
2. `foundry_feedback_list` — find unresolved feedback for the artefact.
|
|
42
46
|
3. Read the artefact file.
|
|
43
|
-
4. If the cycle
|
|
47
|
+
4. If the cycle declares `inputs`, discover them via filesystem scan against each input type's `file-patterns` (same protocol as first-generation step 6). Re-read the relevant files — they may have changed on disk since the previous iteration (nothing in this cycle wrote to them, but the user may have modified them between iterations).
|
|
44
48
|
5. For each unresolved feedback item, either:
|
|
45
49
|
- Address it and call `foundry_feedback_action` (marks item `actioned`), or
|
|
46
50
|
- Call `foundry_feedback_wontfix` with a justification — available only for `law:` / `human` tags (validation feedback must be actioned).
|
|
47
51
|
6. Update the artefact file.
|
|
48
52
|
7. `foundry_stage_end({summary})`.
|
|
49
53
|
|
|
50
|
-
##
|
|
54
|
+
## Write invariant
|
|
51
55
|
|
|
52
|
-
|
|
56
|
+
Forge may only write to:
|
|
57
|
+
- Files matching the output artefact type's `file-patterns`.
|
|
58
|
+
- `WORK.md` and `WORK.history.yaml` (tool-managed).
|
|
59
|
+
|
|
60
|
+
Everything else on disk — including files of the cycle's input types, files of unrelated artefact types, and files outside any artefact type — is read-only for this stage. This is not an honor-system rule: `foundry_stage_finalize` returns `{error: 'unexpected_files'}` and `sort`'s `checkModifiedFiles` routes a violation on the next call. Either outcome marks the cycle's target artefact `blocked` and you do not get a retry.
|
|
61
|
+
|
|
62
|
+
When a cycle's output type overlaps with one of its input types (e.g. a `refine-haiku` cycle with input `haiku` and output `haiku`), the overlap is intentional: the cycle's job is to modify existing files of that type. The write invariant still holds — you may only touch files matching the output type's patterns, which in this case includes the files you read as inputs.
|
|
53
63
|
|
|
54
64
|
## Unresolved feedback
|
|
55
65
|
|
|
@@ -75,4 +85,4 @@ Feedback tagged `human` (from the human-appraise stage) takes absolute priority:
|
|
|
75
85
|
- You do not evaluate or score the artefact.
|
|
76
86
|
- You do not mark feedback as actioned unless you actually changed the artefact to address it.
|
|
77
87
|
- You do not wont-fix validation feedback.
|
|
78
|
-
- You do not
|
|
88
|
+
- You do not write to any file outside the output artefact type's `file-patterns` (plus `WORK.md` / `WORK.history.yaml`). Input files are read-only unless the output type's patterns happen to cover them.
|