From 43b07aca48c1c69e1f67955d2699a612cbc70fdc Mon Sep 17 00:00:00 2001 From: Richard Zink Date: Tue, 17 Nov 2026 14:43:38 +0100 Subject: [PATCH] Factory: skills per phase Co-Authored-By: Claude Sonnet 5.5 --- CHANGELOG.md | 7 ++++++ server/src/factory.rs | 9 ++++++-- web/src/components/Factory.tsx | 39 +++++++++++++++++++++++++++++++++- web/src/i18n/de.ts | 4 ++++ web/src/i18n/en.ts | 4 ++++ web/src/whatsnew.ts | 4 ++++ 6 files changed, 64 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0554b97..9ca32f0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,13 @@ All notable changes to CodeCraft. Versions follow [Semantic Versioning](https://semver.org/); until 1.0, minor versions may contain breaking changes. +## [Unreleased] + +### Added + +- **Factory: skills per phase.** In the repository settings, each phase (review, build, acceptance) can have + skills switched on; the chat of that phase follows them in every turn. + ## [v202611-00056] – 2026-11-17 ### Added diff --git a/server/src/factory.rs b/server/src/factory.rs index 28dc198..87144b8 100644 --- a/server/src/factory.rs +++ b/server/src/factory.rs @@ -49,6 +49,9 @@ pub struct PhaseCfg { /// Extra instructions appended to the phase prompt. #[serde(default)] pub extra_prompt: String, + /// Skills (names) switched on for the chat of this phase; only the CodeCraft agent uses them. + #[serde(default)] + pub skills: Vec, } fn default_agent() -> String { @@ -69,7 +72,7 @@ fn default_rework() -> i64 { impl Default for PhaseCfg { fn default() -> Self { - Self { model: String::new(), agent: default_agent(), permission_mode: default_mode(), timeout_minutes: default_timeout(), max_attempts: default_attempts(), extra_prompt: String::new() } + Self { model: String::new(), agent: default_agent(), permission_mode: default_mode(), timeout_minutes: default_timeout(), max_attempts: default_attempts(), extra_prompt: String::new(), skills: Vec::new() } } } @@ -171,6 +174,7 @@ impl RepoCfg { } p.timeout_minutes = p.timeout_minutes.clamp(1, 24 * 60); p.max_attempts = p.max_attempts.clamp(1, 10); + p.skills = p.skills.iter().map(|n| n.trim().to_string()).filter(|n| !n.is_empty() && n.len() <= 64).take(10).collect(); } Ok(()) } @@ -881,7 +885,8 @@ fn start_phase(app: &Arc, user: &User, cfg: &RepoCfg, issue: i64, phase: &s telegram_quiet: true, summary: String::new(), color: None, - icon: None, skills: Vec::new(), + icon: None, + skills: pc.skills.clone(), }; let session = app.save_session(session)?; let run_id = crate::types::new_id(); diff --git a/web/src/components/Factory.tsx b/web/src/components/Factory.tsx index f34388e..c0b8add 100644 --- a/web/src/components/Factory.tsx +++ b/web/src/components/Factory.tsx @@ -30,6 +30,7 @@ interface PhaseCfg { timeout_minutes: number; max_attempts: number; extra_prompt: string; + skills: string[]; } interface RepoCfg { url: string; @@ -575,11 +576,46 @@ function FactoryOverview({ onSettings }: { onSettings: () => void }) { ); } -const blankPhase = (): PhaseCfg => ({ model: "", agent: "codecraft", permission_mode: "auto", timeout_minutes: 60, max_attempts: 2, extra_prompt: "" }); +const blankPhase = (): PhaseCfg => ({ model: "", agent: "codecraft", permission_mode: "auto", timeout_minutes: 60, max_attempts: 2, extra_prompt: "", skills: [] }); const blankRepo = (connection = "", kind = "gitea"): RepoCfg => ({ url: "", kind, connection, token: "", label: "factory", max_parallel: 1, max_rework: 2, allowed_users: [], enabled: true, review: blankPhase(), build: blankPhase(), qa: blankPhase() }); const blankConn = (): Connection => ({ id: "", name: "", kind: "gitea", url: "", token: "", owner: "" }); const MODES = ["default", "auto", "accept_edits", "bypass"]; +/** Skills switched on for the chat of one phase (the agent follows them in every turn). */ +function PhaseSkills({ value, onChange }: { value: string[]; onChange: (v: string[]) => void }) { + const t = useT(); + const [all, setAll] = useState<{ name: string; description: string }[]>([]); + useEffect(() => { + get<{ skills: { name: string; description: string }[] }>("/commands") + .then((d) => setAll(d.skills)) + .catch(() => {}); + }, []); + const rest = all.filter((s) => !value.includes(s.name)); + return ( +
+ {t("factory.skills")} +
+ {value.map((n) => ( + + ))} + {rest.length > 0 && value.length < 10 && ( + + )} +
+
{t("factory.skillsHint")}
+
+ ); +} + function PhaseForm({ phase, value, onChange }: { phase: Phase; value: PhaseCfg; onChange: (patch: Partial) => void }) { const t = useT(); return ( @@ -614,6 +650,7 @@ function PhaseForm({ phase, value, onChange }: { phase: Phase; value: PhaseCfg; {t("factory.attempts")} onChange({ max_attempts: Math.max(1, Number(e.target.value) || 1) })} /> + onChange({ skills })} />