diff --git a/README.md b/README.md index 02710e1..cc9172b 100644 --- a/README.md +++ b/README.md @@ -1,30 +1,57 @@ -# DESIGNOSFORGE v2.0.0 Source for Codex +# DESIGNOSFORGE v2.1.0 Source for Codex DESIGNOSFORGE is an open-source Codex agent and skill system for turning AI design from prompt guessing into a governed, inspectable design workflow. -v2.0.0 moves the project from prompt governance into a mathematical design kernel. It now models design decisions as vectors, probabilities, constraints, ranked candidate directions, critic scores, and failure-memory retrieval. +v2.1.0 adds **Loop Engineering**: a system-runtime layer for scheduled, event-driven, multi-agent, tool-connected loops that can keep project context, validate results, and write durable memory. -## What Changed In v2.0 +## What Changed In v2.1 -- `DesignKernel`: a new end-to-end orchestration core for intent parsing, routing, memory, constraints, candidates, critics, tool planning, and PromptPacketV2. -- `DesignMathEngine`: Chinese/Latin vectorization, cosine and jaccard similarity, softmax route probability, entropy, confidence margin, Pareto front, TOPSIS, weighted utility, and residual-risk penalty. -- `PromptPacketV2`: a richer design contract with route math, memory math, constraint math, candidate optimization, critic aggregation, and failure memory. -- Stronger city identity behavior: routes public-cultural logo tasks toward modular identity systems and actively penalizes generic landmark stacking. -- Stronger photography behavior: locks face identity, body anatomy, expression, clothing, light direction, skin texture, and documentary scene truth. -- Stronger EnvArt behavior: CADMCP remains the source-fidelity route for CAD/DWG/DXF, construction drawings, layer semantics, wall/opening topology, and plan-to-board workflows. +- `DesignKernel`: keeps the v2 mathematical orchestration core for intent parsing, routing, memory, constraints, candidates, critics, tool planning, and PromptPacketV2. +- `LoopPromptPack`: remains the independent prompt-iteration companion pack for self-refine, failed-result recovery, branch search, visual-result repair, and seamless video loops. +- `LoopEngineeringBlueprint`: new runtime blueprint for scheduler, worktree isolation, skill context, external connectors, validation gates, and persistent memory. +- `LoopEngineeringOS`: new registry/capability route for long-running agent loops, GitHub/CI/PR workflows, and complete project-following workflows. +- GitHub release planning now defaults to `v2.1.0` and includes compile, source validator, CLI smoke, and pytest gates. +- Skill packaging now exposes Loop Engineering as a separate layer rather than replacing PromptPacketV2 or LoopPromptPack. ## Why It Matters -Most AI design workflows fail after generation starts. DESIGNOSFORGE moves quality control before generation: +Most AI design workflows fail because the agent loses the project thread. DESIGNOSFORGE v2.1 makes the workflow answer six engineering questions before it runs: -- one dominant focal anchor instead of scattered fragments -- grid, density, and negative-space rules instead of visual noise -- exact visible text instead of pseudo-text and mojibake -- structured PromptPacketV2 output instead of loose prompt paragraphs -- project-context locks instead of mixing commercial and academic competition logic -- memory-case recommendations instead of vague style recall -- mathematical route and candidate audits instead of black-box taste claims -- GitHub-ready release workflows instead of one-off local experiments +- Who wakes the loop? +- How do parallel agents avoid collisions? +- How does the agent know project habits? +- What external systems can it touch? +- Who validates the result? +- How does it remember yesterday? + +Principle: the model may forget, but the repository must not. + +## Capability Call Table + +| User intent | Primary route | Output | Validation | +| --- | --- | --- | --- | +| General design strategy | `DesignKernel` | `PromptPacketV2` | route math, critic aggregation, constraints | +| Iterative prompt refinement | `LoopPromptEngine` | `LoopPromptPack` | one-axis iteration, stop conditions, failure memory | +| Durable agent loops | `LoopEngineeringOS` | `LoopEngineeringBlueprint` | scheduler, worktree isolation, verifier split, memory | +| Brand, VI, city identity | `brandVIos` | mark system direction and prompt packet | grid derivation, dynamic system, no random landmarks | +| Academic infovis boards | `InfoVisOS` / `LayeredBoardComposer` | board strategy and modules | thesis hierarchy, evidence modules, text accuracy | +| EnvArt/CAD production | `EnvArtCADMCPBridge` | CAD-aware plan or prompt packet | CAD health, DXF audit, geometry locks | +| Photography/retouching | `PhotographyOS` | edit or shoot plan | identity preservation, light direction, artifact check | +| GitHub/release work | `GitHubManager` / GitHub plugin | release plan or PR body | compileall, tests, source validator, CI/PR checks | + +## Quick Check + +```powershell +$env:PYTHONPATH='.' +$env:PYTHONUTF8='1' +py -m app.cli capabilities +py -m app.cli kernel loop-engineering "Loop Engineering 调度 issue CI,worktree 并行隔离,validator 验收,写入长期记忆" +py -m app.cli kernel loop-prompt "create a design prompt with three loop iterations and self critique" +py -m app.cli github release-plan --version v2.1.0 +py -m compileall app tests tools +py -m pytest -q +py tools\validate_source_skill.py +``` ## Open Source @@ -36,35 +63,21 @@ Use it to study, adapt, and extend: - design-agent orchestration - visual prompt governance - mathematical design routing +- Loop Engineering runtime design - aesthetic quality gates - LoRA aesthetic corpus planning -- photography and retouching aesthetic-memory planning +- photography and retouching workflows - environmental-art CAD/DWG/DXF source-fidelity workflows -- training-aware aesthetic memory indexing -- project-context routing for commercial, academic competition, and public cultural work - GitHub-ready release workflows See `docs/CODEX_INSTALL.md` for local Codex skill installation. -## Quick Check - -```bash -PYTHONPATH=. python -m app.cli capabilities -PYTHONPATH=. python -m app.cli kernel plan "为安徽省钢城马鞍山市设计城市标识系统logo,要求现代、公共文化传播、不要堆砌地标" -PYTHONPATH=. python -m app.cli kernel math-audit "拯救课堂纪实照片,不要改变人物本来的面貌形象" -PYTHONPATH=. python -m app.cli kernel prompt-packet "用CADMCP审核环艺DWG平面并生成展板分析图提示词" -PYTHONPATH=. python -m app.cli lora audit-corpus -PYTHONPATH=. python -m app.cli lora build-memory-index -PYTHONPATH=. python -m app.cli envart-cad plan "用CADMCP审核环艺DWG平面并生成展板分析图提示词" -PYTHONPATH=. python -m app.cli github release-plan --version v2.0.0 -PYTHONPATH=. pytest -q -``` - ## GitHub -This source package includes a GitHub Actions workflow, PR body, release notes, and a source skill validator. -After binding a target remote, push the main branch and tag `v2.0.0`, then open a draft PR using `docs/PR_BODY_v2.0.0.md`. +This source package includes GitHub workflow docs, PR bodies, release notes, and a source skill validator. + +For v2.1 release work, use `docs/PR_BODY_v2.1.0.md` and `docs/RELEASE_NOTES_v2.1.0.md`. Do not publish releases or notify external systems without explicit user intent. ## Codex Placement -Use `codex_skill/designos-forge/SKILL.md` as the Codex skill entry. The included Codex entry has been upgraded to `designos-forge` v2.0.0 with a mathematical DesignKernel, PromptPacketV2, aesthetic memory, failure memory, photography, EnvArt CADMCP fusion, prompt precision, text/encoding health, environment-aware routing, and Git/GitHub release planning. +Use `codex_skill/designos-forge/SKILL.md` as the Codex skill entry. The included skill has been upgraded to `designos-forge` v2.1.0 with DesignKernel, PromptPacketV2, LoopPromptPack, LoopEngineeringOS, aesthetic memory, failure memory, photography, EnvArt CADMCP fusion, prompt precision, text/encoding health, project-context routing, GitOps, and GitHub release planning. diff --git a/app/__init__.py b/app/__init__.py index 8c0d5d5..9aa3f90 100644 --- a/app/__init__.py +++ b/app/__init__.py @@ -1 +1 @@ -__version__ = "2.0.0" +__version__ = "2.1.0" diff --git a/app/cli.py b/app/cli.py index 00bfe3a..541c3a8 100644 --- a/app/cli.py +++ b/app/cli.py @@ -39,7 +39,7 @@ def main(): github_parser = sub.add_parser("github") github_parser.add_argument("action", choices=("status", "release-plan", "pr-template")) github_parser.add_argument("--repo", default=".") - github_parser.add_argument("--version", default="v2.0.0") + github_parser.add_argument("--version", default="v2.1.0") quality_parser = sub.add_parser("quality") quality_parser.add_argument("action", choices=("audit", "guardrails")) quality_parser.add_argument("text") @@ -47,7 +47,7 @@ def main(): envart_cad_parser.add_argument("action", choices=("plan",)) envart_cad_parser.add_argument("text") kernel_parser = sub.add_parser("kernel") - kernel_parser.add_argument("action", choices=("plan", "prompt-packet", "loop-prompt", "math-audit", "record-failure")) + kernel_parser.add_argument("action", choices=("plan", "prompt-packet", "loop-prompt", "loop-engineering", "math-audit", "record-failure")) kernel_parser.add_argument("text") kernel_parser.add_argument("--domain", default="general-design") kernel_parser.add_argument("--failure-mode", default="unspecified_failure") @@ -94,6 +94,8 @@ def main(): print(json_dumps(plan["prompt_packet_v2"])) elif args.action == "loop-prompt": print(json_dumps(plan["loop_prompt_pack"])) + elif args.action == "loop-engineering": + print(json_dumps(plan["loop_engineering"])) elif args.action == "math-audit": print(json_dumps(plan["math_trace"])) else: diff --git a/app/core/capabilities.py b/app/core/capabilities.py index beeeeff..4621e6d 100644 --- a/app/core/capabilities.py +++ b/app/core/capabilities.py @@ -15,7 +15,18 @@ "ConstraintPenaltyModel", "DesignStateGraph", "HybridRouter", "AestheticGenomeExtractor", "DesignMemoryVectorIndex", "FailureMemoryBank", "MultiCandidateGenerator", "CriticEnsemble", "ConstraintSolver", "ToolExecutionPlanner", "PromptPacketV2Builder", - "LoopPromptEngine", "LoopPromptPackBuilder", + "LoopPromptEngine", "LoopPromptPackBuilder", "LoopEngineeringBlueprintBuilder", "LoopEngineeringOS", +) + +CALL_TABLE = ( + ("general_design_strategy", "DesignKernel", "PromptPacketV2", "route math, critic aggregation, constraints"), + ("iterative_prompt_refinement", "LoopPromptEngine", "LoopPromptPack", "one-axis iteration, stop conditions, failure memory"), + ("durable_agent_loop", "LoopEngineeringOS", "LoopEngineeringBlueprint", "scheduler, worktree isolation, verifier split, persistent memory"), + ("brand_vi_city_identity", "brandVIos", "PromptPacketV2", "grid derivation, dynamic system, no random landmark stacking"), + ("academic_infovis_board", "InfoVisOS/LayeredBoardComposer", "PromptPacketV2", "thesis hierarchy, evidence modules, text accuracy"), + ("envart_cad_production", "EnvArtCADMCPBridge", "CAD-aware plan", "CAD health, DXF audit, geometry locks"), + ("photography_retouching", "PhotographyOS", "edit or shoot plan", "identity preservation, light direction, artifact check"), + ("github_release_work", "GitHubManager/GitOpsManager", "release plan or PR body", "compileall, tests, source validator, CI/PR checks"), ) def capability_report(): @@ -25,4 +36,7 @@ def capability_report(): lines.append("") lines.append("Skills:") lines.extend(f"- {skill.name}: {skill.description}" for skill in registry.list()) + lines.append("") + lines.append("Capability Call Table:") + lines.extend(f"- {intent}: route={route}; output={output}; validation={validation}" for intent, route, output, validation in CALL_TABLE) return "\n".join(lines) diff --git a/app/core/design_kernel.py b/app/core/design_kernel.py index 778e456..1a41245 100644 --- a/app/core/design_kernel.py +++ b/app/core/design_kernel.py @@ -16,11 +16,11 @@ weighted_sum, ) from .envart_cadmcp import EnvArtCADMCPBridge -from .loop_prompt import LoopPromptPackBuilder +from .loop_prompt import LoopEngineeringBlueprintBuilder, LoopPromptPackBuilder from .task_router import ROUTES, TaskRouterAgent -VERSION = "2.0.0" +VERSION = "2.1.0" FAILURE_MEMORY_PATH = Path("lora_training_sandbox/aesthetic_corpus/failure_memory.jsonl") @@ -182,6 +182,7 @@ class DesignKernelPlan: math_trace: dict prompt_packet_v2: dict loop_prompt_pack: dict + loop_engineering: dict def to_dict(self): return asdict(self) @@ -759,6 +760,7 @@ def plan(self, intent, route, constraints): steps = ["parse_intent", "retrieve_memory", "solve_constraints", "rank_candidates", "run_critic_ensemble"] tools = [] loop_detection = LoopPromptPackBuilder().detect(intent.raw_text, intent=intent, route=route) + loop_engineering_detection = LoopEngineeringBlueprintBuilder().detect(intent.raw_text, loop_detection=loop_detection) if constraints.get("cad_plan"): tools.extend(constraints["cad_plan"].get("preferred_tools", [])) if "prompt_packet" in intent.delivery_modes: @@ -768,6 +770,9 @@ def plan(self, intent, route, constraints): tools.append("LoopPromptPack") if loop_detection.loop_type == "seamless_video_loop": tools.append("ShortDramaAIGC_OS") + if loop_engineering_detection.active: + steps.extend(["build_loop_engineering_blueprint", "define_scheduler_isolation_validation_memory"]) + tools.append("LoopEngineeringBlueprint") if "git_release" in intent.delivery_modes: tools.extend(["GitOpsManager", "GitHubManager"]) if route["skill_name"] == "PhotographyOS": @@ -869,6 +874,7 @@ def __init__(self): self.failures = FailureMemoryBank() self.packet = PromptPacketV2Builder() self.loop_prompt = LoopPromptPackBuilder() + self.loop_engineering = LoopEngineeringBlueprintBuilder() def plan(self, text): intent = self.intent_parser.parse(text) @@ -894,6 +900,14 @@ def plan(self, text): constraints=constraints, failure_memory=failure_memory, ) + loop_engineering = self.loop_engineering.build( + intent.raw_text, + intent=intent, + route=route, + loop_detection=LoopPromptPackBuilder().detect(intent.raw_text, intent=intent, route=route), + constraints=constraints, + failure_memory=failure_memory, + ) return DesignKernelPlan( schema_version=VERSION, intent=asdict(intent), @@ -909,6 +923,7 @@ def plan(self, text): math_trace=math_trace, prompt_packet_v2=prompt_packet, loop_prompt_pack=loop_prompt_pack, + loop_engineering=loop_engineering, ) def _math_trace(self, route, memory, constraints, candidates, critics, failure_memory): diff --git a/app/core/loop_prompt.py b/app/core/loop_prompt.py index 70bcb98..6cd3693 100644 --- a/app/core/loop_prompt.py +++ b/app/core/loop_prompt.py @@ -1,7 +1,55 @@ from dataclasses import asdict, dataclass -LOOP_PROMPT_PACK_VERSION = "2.0.0-loop.1" +LOOP_PROMPT_PACK_VERSION = "2.1.0-loop.1" +LOOP_ENGINEERING_VERSION = "2.1.0-loop-engineering.1" + + +LOOP_ENGINEERING_TRIGGERS = ( + "loop engineering", + "loop-engineering", + "agent loop", + "autonomous loop", + "scheduler", + "schedule", + "event trigger", + "trigger", + "parallel", + "multi-agent", + "multiple agents", + "worktree", + "isolation", + "skill", + "project knowledge", + "connector", + "external system", + "issue", + "ci", + "pr", + "acceptance", + "validation", + "validator", + "verifier", + "review", + "memory", + "persistent memory", + "long-running loop", + "\u8c03\u5ea6", + "\u5b9a\u65f6", + "\u4e8b\u4ef6\u89e6\u53d1", + "\u89e6\u53d1", + "\u5e76\u884c", + "\u591a\u4e2a agent", + "\u9694\u79bb", + "\u9879\u76ee\u77e5\u8bc6", + "\u8fde\u63a5\u5668", + "\u5916\u90e8\u7cfb\u7edf", + "\u9a8c\u6536", + "\u9a8c\u8bc1", + "\u8bb0\u5fc6", + "\u957f\u671f loop", + "\u8fd0\u884c\u7cfb\u7edf", +) @dataclass(frozen=True) @@ -30,12 +78,39 @@ def to_dict(self): return asdict(self) +@dataclass(frozen=True) +class LoopEngineeringDetection: + active: bool + confidence: float + trigger_hits: tuple[str, ...] + runtime_mode: str + + def to_dict(self): + return asdict(self) + + LOOP_PROFILES = { "self_refine_loop": LoopProfile( loop_type="self_refine_loop", title="Self-refine prompt iteration", purpose="Draft, critique, revise, and rescore a prompt while keeping the original brief stable.", - triggers=("loop", "循环", "闭环", "迭代", "反复", "多轮", "自我检查", "继续优化", "再优化", "复盘"), + triggers=( + "loop", + "iteration", + "self critique", + "self-check", + "refine", + "continue optimizing", + "\u5faa\u73af", + "\u95ed\u73af", + "\u8fed\u4ee3", + "\u53cd\u590d", + "\u591a\u8f6e", + "\u81ea\u6211\u68c0\u67e5", + "\u7ee7\u7eed\u4f18\u5316", + "\u518d\u4f18\u5316", + "\u590d\u76d8", + ), state_schema=("iteration", "stable_brief", "draft_prompt", "critique", "revision_delta", "quality_score"), critique_axes=("intent_fit", "specificity", "constraint_compliance", "text_accuracy", "prompt_executability"), revision_axes=("brief_boundary", "composition", "style_precision", "text_policy", "negative_controls"), @@ -50,7 +125,27 @@ def to_dict(self): loop_type="design_critic_loop", title="Design critic revision loop", purpose="Improve visual design prompts through repeated aesthetic critique and controlled revision.", - triggers=("审美", "画面", "排版", "构图", "细碎", "脏乱", "秩序", "文字精准", "乱码", "设计感"), + triggers=( + "aesthetic", + "composition", + "layout", + "typography", + "fragmented", + "messy", + "dirty", + "text precision", + "mojibake", + "\u5ba1\u7f8e", + "\u753b\u9762", + "\u6392\u7248", + "\u6784\u56fe", + "\u7ec6\u788e", + "\u810f\u4e71", + "\u79e9\u5e8f", + "\u6587\u5b57\u7cbe\u51c6", + "\u4e71\u7801", + "\u8bbe\u8ba1\u611f", + ), state_schema=("iteration", "visual_goal", "dominant_anchor", "layout_grid", "critic_findings", "revision_delta"), critique_axes=("dominant_anchor", "layout_order", "density_ceiling", "color_control", "typography", "anti_fragmentation"), revision_axes=("focal_hierarchy", "grid", "negative_space", "palette", "type_hierarchy", "visible_text"), @@ -65,7 +160,25 @@ def to_dict(self): loop_type="failure_memory_loop", title="Failure-memory recovery loop", purpose="Convert rejected or failed outputs into explicit failure modes and safer next prompts.", - triggers=("失败", "不成功", "不算数", "当做没发生", "好丑", "不好", "跑偏", "崩了", "重来"), + triggers=( + "failed", + "failure", + "not successful", + "does not count", + "ignore this result", + "bad", + "off target", + "redo", + "\u5931\u8d25", + "\u4e0d\u6210\u529f", + "\u4e0d\u7b97\u6570", + "\u5f53\u505a\u6ca1\u53d1\u751f", + "\u597d\u4e11", + "\u4e0d\u597d", + "\u8dd1\u504f", + "\u5d29\u4e86", + "\u91cd\u6765", + ), state_schema=("iteration", "observed_failure", "failure_mode", "root_cause", "locked_elements", "next_prompt"), critique_axes=("root_cause", "locked_elements", "drift_source", "missing_constraint", "overconstraint"), revision_axes=("failure_mode", "must_not_repeat", "source_lock", "next_attempt_boundary", "qa_gate"), @@ -80,7 +193,23 @@ def to_dict(self): loop_type="branch_search_loop", title="Branch search prompt loop", purpose="Explore several prompt directions, score them, and recombine the best parts into a stronger next prompt.", - triggers=("多方案", "方向", "分支", "branch", "探索", "候选", "三版", "多版", "方案比较"), + triggers=( + "branch", + "multiple options", + "directions", + "explore", + "candidate", + "three versions", + "compare options", + "\u591a\u65b9\u6848", + "\u65b9\u5411", + "\u5206\u652f", + "\u63a2\u7d22", + "\u5019\u9009", + "\u4e09\u7248", + "\u591a\u7248", + "\u65b9\u6848\u6bd4\u8f83", + ), state_schema=("iteration", "branches", "branch_scores", "winning_parts", "recombined_prompt", "discarded_parts"), critique_axes=("novelty", "domain_fit", "constraint_fit", "aesthetic_potential", "risk_control"), revision_axes=("branch_thesis", "composition_logic", "style_axis", "evidence_support", "risk_boundary"), @@ -95,7 +224,25 @@ def to_dict(self): loop_type="visual_result_loop", title="Visual-result repair loop", purpose="Diagnose an image or generated result, preserve what works, and produce a targeted edit or regeneration prompt.", - triggers=("改图", "修图", "结果", "优化这张", "拯救", "继续修", "不要改变", "保留", "参考图"), + triggers=( + "edit image", + "retouch", + "result", + "optimize this image", + "repair", + "preserve", + "do not change", + "reference image", + "\u6539\u56fe", + "\u4fee\u56fe", + "\u7ed3\u679c", + "\u4f18\u5316\u8fd9\u5f20", + "\u62ef\u6551", + "\u7ee7\u7eed\u4fee", + "\u4e0d\u8981\u6539\u53d8", + "\u4fdd\u7559", + "\u53c2\u8003\u56fe", + ), state_schema=("iteration", "source_image_locks", "observed_result", "change_only", "preserve", "next_edit_prompt"), critique_axes=("identity_or_object_lock", "composition", "lighting", "texture", "geometry", "text_or_label_integrity"), revision_axes=("local_edit_region", "preservation_rule", "blend_rule", "crop_or_layout", "color_grade"), @@ -110,7 +257,19 @@ def to_dict(self): loop_type="seamless_video_loop", title="Seamless video loop prompt", purpose="Create video or motion prompts where the first and last frames connect without a visible jump.", - triggers=("无缝循环", "首尾", "循环视频", "loop video", "seamless", "动效", "镜头循环", "首尾一致"), + triggers=( + "loop video", + "seamless", + "first and last frame", + "closed camera path", + "motion loop", + "\u65e0\u7f1d\u5faa\u73af", + "\u9996\u5c3e", + "\u5faa\u73af\u89c6\u9891", + "\u52a8\u6548", + "\u955c\u5934\u5faa\u73af", + "\u9996\u5c3e\u4e00\u81f4", + ), state_schema=("iteration", "first_frame", "last_frame", "motion_period", "camera_path", "loop_closure", "temporal_artifacts"), critique_axes=("first_last_consistency", "motion_continuity", "camera_path_closure", "lighting_continuity", "subject_continuity"), revision_axes=("periodic_motion", "closed_camera_path", "stable_subject_state", "repeatable_particles", "temporal_negative_prompt"), @@ -183,7 +342,7 @@ def build( ): detection = self.detect(text, intent=intent, route=route) profile = LOOP_PROFILES.get(detection.loop_type, LOOP_PROFILES["self_refine_loop"]) - pack = { + return { "schema_version": LOOP_PROMPT_PACK_VERSION, "packet_type": "LoopPromptPack", "relationship_to_prompt_packet_v2": { @@ -204,7 +363,6 @@ def build( "write_failure_memory_after_rejection": profile.loop_type in ("failure_memory_loop", "visual_result_loop", "design_critic_loop"), }, } - return pack def _loop_contract(self, profile, detection): return { @@ -285,3 +443,324 @@ def _quality_gate(self, profile): "loop_specific_axes": profile.critique_axes, "negative_controls": profile.negative_controls, } + + +class LoopEngineeringBlueprintBuilder: + """System blueprint for long-running, tool-connected, memory-backed agent loops.""" + + def detect(self, text, loop_detection=None): + raw = str(text or "") + lowered = raw.lower() + hits = tuple(trigger for trigger in LOOP_ENGINEERING_TRIGGERS if trigger.lower() in lowered) + loop_active = bool(getattr(loop_detection, "active", False)) + systemic_hits = sum( + 1 + for token in ( + "system", + "engineering", + "runtime", + "autonomous", + "long-running", + "architecture", + "\u7cfb\u7edf", + "\u5de5\u7a0b", + "\u8fd0\u884c", + "\u81ea\u52a8", + "\u957f\u671f", + "\u67b6\u6784", + "\u9769\u65b0", + ) + if token in lowered or token in raw + ) + score = len(hits) + systemic_hits * 0.4 + (0.8 if loop_active else 0.0) + active = bool(hits) or score >= 1.2 + runtime_mode = self._runtime_mode(lowered, raw) + confidence = 0.0 if not active else min(0.98, 0.52 + score * 0.08) + return LoopEngineeringDetection( + active=active, + confidence=round(confidence, 4), + trigger_hits=tuple(dict.fromkeys(hits)), + runtime_mode=runtime_mode, + ) + + def build(self, text, intent=None, route=None, loop_detection=None, constraints=None, failure_memory=None): + detection = self.detect(text, loop_detection=loop_detection) + route_skill = (route or {}).get("skill_name", "") + context = tuple(getattr(intent, "project_contexts", ()) or ()) + domains = tuple(getattr(intent, "domains", ()) or ()) + return { + "schema_version": LOOP_ENGINEERING_VERSION, + "packet_type": "LoopEngineeringBlueprint", + "relationship_to_loop_prompt_pack": { + "mode": "system_runtime_layer", + "does_not_replace_loop_prompt_pack": True, + "use_policy": ( + "Use LoopPromptPack for prompt iteration. Use LoopEngineeringBlueprint when the loop must run as a " + "scheduled/event-driven, multi-agent, tool-connected, validated, persistent system." + ), + }, + "activation": detection.to_dict(), + "six_question_contract": self._six_question_contract(), + "runtime_blueprint": { + "scheduler": self._scheduler(text, detection), + "parallel_isolation": self._parallel_isolation(text), + "skill_context": self._skill_context(route_skill, domains, context), + "external_connectors": self._external_connectors(text, route_skill), + "validation_gate": self._validation_gate(route_skill, constraints or {}), + "persistent_memory": self._persistent_memory(failure_memory or {}), + }, + "agent_topology": self._agent_topology(route_skill), + "state_schema": self._state_schema(), + "handoff_contract": self._handoff_contract(), + "failure_controls": self._failure_controls(), + "prompt_scaffold": self._prompt_scaffold(), + "export_policy": { + "can_be_saved_as_standalone_json": True, + "can_be_attached_to_loop_prompt_pack": True, + "recommended_memory_file": "docs/LOOP_STATE.md", + "recommended_task_board": "GitHub Issues or local markdown board", + }, + } + + def _runtime_mode(self, lowered, raw): + if any(token in lowered for token in ("ci", "test", "issue", "pr", "github")): + return "event_connected_dev_loop" + if any(token in lowered or token in raw for token in ("design", "aesthetic", "visual", "prompt", "\u8bbe\u8ba1", "\u5ba1\u7f8e", "\u56fe", "\u89c6\u89c9", "\u63d0\u793a\u8bcd")): + return "design_quality_loop" + if any(token in lowered or token in raw for token in ("daily", "every day", "half hour", "30 minutes", "\u5b9a\u65f6", "\u6bcf\u5929", "\u6bcf\u534a\u5c0f\u65f6", "\u8c03\u5ea6")): + return "scheduled_monitor_loop" + return "general_agent_loop" + + def _six_question_contract(self): + return ( + { + "question": "who_wakes_the_loop", + "engineering_layer": "scheduler", + "must_answer": "manual trigger, cron interval, event trigger, test failure trigger, or goal-until-done trigger", + }, + { + "question": "how_parallel_agents_do_not_collide", + "engineering_layer": "parallel_isolation", + "must_answer": "worktree/sandbox per agent, ownership boundaries, merge policy, conflict gate", + }, + { + "question": "how_the_agent_knows_project_habits", + "engineering_layer": "skill_context", + "must_answer": "required skills, project rules, no-touch paths, naming conventions, known traps", + }, + { + "question": "what_external_systems_it_can_touch", + "engineering_layer": "external_connectors", + "must_answer": "issues, CI, tests, database, PR, notifications, local files, browser, CAD, image tools", + }, + { + "question": "who_validates_the_result", + "engineering_layer": "validation_gate", + "must_answer": "separate executor and verifier, tests, critics, human review threshold, rollback gate", + }, + { + "question": "how_it_remembers_yesterday", + "engineering_layer": "persistent_memory", + "must_answer": "state file, decisions, confirmed facts, failures, blocked items, next wake target", + }, + ) + + def _scheduler(self, text, detection): + raw = str(text or "") + lowered = raw.lower() + if any(token in lowered or token in raw for token in ("daily", "every day", "yesterday", "\u6bcf\u5929", "\u6bcf\u65e5", "\u6628\u665a")): + trigger = "cron_daily" + cadence = "once_per_day" + elif any(token in lowered or token in raw for token in ("half hour", "30 minutes", "30\u5206\u949f", "\u534a\u5c0f\u65f6", "\u6bcf\u534a\u5c0f\u65f6")): + trigger = "cron_interval" + cadence = "30_minutes" + elif any(token in lowered for token in ("ci", "issue", "pr", "test", "event")): + trigger = "event_trigger" + cadence = "on_external_event" + elif detection.active: + trigger = "goal_until_done" + cadence = "iterate_until_stop_condition" + else: + trigger = "manual" + cadence = "user_invoked" + return { + "trigger_type": trigger, + "cadence": cadence, + "wake_conditions": ( + "new user request", + "external event arrives", + "validation fails", + "scheduled time reached", + "open task remains incomplete", + ), + "stop_conditions": ( + "acceptance gates pass", + "same blocker repeats three times", + "human review required", + "budget or safety boundary reached", + ), + } + + def _parallel_isolation(self, text): + lowered = str(text or "").lower() + needs_parallel = any(token in lowered for token in ("parallel", "multi-agent", "multiple agents", "worktree", "\u5e76\u884c", "\u591a\u4e2a agent")) + return { + "isolation_mode": "git_worktree_per_agent" if needs_parallel else "single_workspace_with_file_ownership", + "workspace_rule": "Each executor gets its own branch/worktree when edits may overlap.", + "ownership_policy": ( + "declare touched paths before edit", + "never rewrite files owned by another active agent", + "merge through review, not direct overwrite", + ), + "conflict_gate": "run diff, tests, and reviewer check before merging agent outputs", + } + + def _skill_context(self, route_skill, domains, context): + skill_refs = ["designos-forge"] + if route_skill: + skill_refs.append(route_skill) + if "spatial-cad-production" in context or "environmental-art" in domains: + skill_refs.append("cad-drawing-control") + if "photography" in domains: + skill_refs.append("PhotographyOS") + return { + "required_skill_refs": tuple(dict.fromkeys(skill_refs)), + "project_knowledge_sources": ( + "codex_skill/designos-forge/SKILL.md", + "docs/LOOP_PROMPT_PACK.md", + "docs/LOOP_ENGINEERING.md", + "lora_training_sandbox/aesthetic_corpus/aesthetic_memory_index.json", + ), + "long_term_rules": ( + "respect no-touch directories and user changes", + "route by project context before visual style", + "write rejected patterns into failure memory", + "keep visible text exact and UTF-8 safe", + ), + } + + def _external_connectors(self, text, route_skill): + lowered = str(text or "").lower() + connectors = ["local_files", "git"] + if any(token in lowered for token in ("github", "issue", "pr", "ci")): + connectors.extend(["github_issues", "github_actions", "pull_requests"]) + if "browser" in lowered or route_skill in ("WebDesignOS", "UIDesignSpecOS"): + connectors.append("browser_qa") + if route_skill == "EnvArtCADMCPBridge": + connectors.append("cad_mcp") + if route_skill == "PhotographyOS": + connectors.append("image_editing") + return { + "connectors": tuple(dict.fromkeys(connectors)), + "tool_boundary": "Prefer deterministic local tools and official connectors; record every external side effect.", + "side_effect_policy": ( + "read before write", + "commit or log durable changes", + "do not publish or notify without explicit user intent", + ), + } + + def _validation_gate(self, route_skill, constraints): + validators = ["self_check", "independent_critic", "git_diff_check"] + if route_skill == "EnvArtCADMCPBridge": + validators.extend(["cad_health", "dxf_audit", "geometry_lock_check"]) + if route_skill == "PhotographyOS": + validators.extend(["identity_preservation_check", "artifact_check"]) + if route_skill in ("InfoVisOS", "LayeredBoardComposer", "PosterDesignOS"): + validators.extend(["layout_order_check", "text_accuracy_check"]) + return { + "executor_validator_split": True, + "validators": tuple(dict.fromkeys(validators)), + "acceptance_thresholds": { + "tests_or_audit": "pass", + "constraint_satisfaction": (constraints.get("penalty_vector", {}) or {}).get("constraint_satisfaction", ">=0.88"), + "no_repeated_failure": True, + "human_review_required_if": "external side effects, ambiguous source truth, destructive edit, or low confidence", + }, + } + + def _persistent_memory(self, failure_memory): + return { + "memory_files": ( + "docs/LOOP_STATE.md", + "lora_training_sandbox/aesthetic_corpus/failure_memory.jsonl", + "delivery manifest or PR body", + ), + "write_after_each_iteration": ( + "current_goal", + "files_touched", + "validation_result", + "decision_log", + "failure_modes", + "next_wake_condition", + ), + "known_failure_count": failure_memory.get("total_items", 0), + "principle": "The model may forget, but the repository must not.", + } + + def _agent_topology(self, route_skill): + return { + "roles": ( + {"name": "scheduler", "responsibility": "wake loop and decide whether work continues"}, + {"name": "executor", "responsibility": f"perform route-specific work through {route_skill or 'selected route'}"}, + {"name": "verifier", "responsibility": "run tests, audits, critic checks, and acceptance gates"}, + {"name": "memory_writer", "responsibility": "persist state, failures, and handoff notes"}, + {"name": "merge_or_handoff", "responsibility": "merge accepted work or ask human review"}, + ), + "recommended_parallelism": "parallel branches only when isolated by worktree and path ownership", + } + + def _state_schema(self): + return { + "loop_id": "stable identifier", + "iteration": "integer", + "wake_reason": "manual | schedule | event | validation_failure | open_goal", + "assigned_agent": "executor/verifier/memory_writer", + "workspace": "main workspace or worktree path", + "input_snapshot": "brief, issue, CI log, file set, or source assets", + "action_plan": "single-iteration plan", + "side_effects": "files, branches, PRs, notifications, external records", + "validation_result": "pass/fail/needs_human", + "memory_delta": "new facts, failures, decisions, next wake condition", + } + + def _handoff_contract(self): + return { + "human_handoff_when": ( + "validator cannot prove correctness", + "same blocker repeats", + "external permission is missing", + "merge conflict requires product judgment", + "visual or cultural judgment is ambiguous", + ), + "handoff_payload": ( + "goal", + "current state", + "what was tried", + "validation evidence", + "remaining decision", + "safe next command", + ), + } + + def _failure_controls(self): + return ( + "Do not let the executor validate itself as the only reviewer.", + "Do not run parallel edits without workspace isolation.", + "Do not loop indefinitely; every loop needs a stop rule.", + "Do not re-open rejected directions without memory evidence.", + "Do not touch external systems without a side-effect log.", + ) + + def _prompt_scaffold(self): + return { + "system_prompt": ( + "You are a Loop Engineering controller. Before acting, answer: trigger, isolation, skill context, " + "external connectors, validation, persistent memory. Run one iteration, validate independently, " + "then write state and stop/continue." + ), + "iteration_output_format": ( + "wake_reason, isolated_workspace, selected_skill_context, planned_side_effects, executor_actions, " + "verifier_checks, memory_delta, stop_or_continue, next_wake_condition" + ), + } diff --git a/app/core/skill_registry.py b/app/core/skill_registry.py index 4e61d65..43e0d68 100644 --- a/app/core/skill_registry.py +++ b/app/core/skill_registry.py @@ -5,38 +5,64 @@ SkillDefinition( "DesignKernel", "kernel", - "v2.0 design intelligence kernel: semantic vectors, state graph, probabilistic routing, aesthetic genome, memory retrieval, candidate ranking, constraint penalty, critic aggregation, failure memory, and PromptPacketV2.", - ("DesignKernel", "2.0", "math kernel", "state graph", "failure memory", "PromptPacketV2", "数学内核"), + "v2.1 design intelligence kernel: semantic vectors, state graph, probabilistic routing, aesthetic genome, memory retrieval, candidate ranking, constraint penalty, critic aggregation, failure memory, PromptPacketV2, LoopPromptPack, and LoopEngineeringBlueprint.", + ("DesignKernel", "2.1", "math kernel", "state graph", "failure memory", "PromptPacketV2", "LoopEngineeringBlueprint", "\u6570\u5b66\u5185\u6838"), ), SkillDefinition( "DesignMathEngine", "algorithm", "Mathematical design layer: mixed-language n-grams, cosine/jaccard similarity, softmax routing, entropy, confidence margin, Pareto front, TOPSIS ranking, and constraint penalty.", - ("math", "algorithm", "vector", "softmax", "TOPSIS", "Pareto", "constraint penalty", "数学", "算法"), + ("math", "algorithm", "vector", "softmax", "TOPSIS", "Pareto", "constraint penalty", "\u6570\u5b66", "\u7b97\u6cd5"), + ), + SkillDefinition( + "LoopEngineeringOS", + "loop_engineering", + "System-level Loop Engineering runtime blueprint: scheduler, worktree isolation, skill context, external connectors, executor/verifier split, persistent memory, handoff, stop conditions, and GitHub/CI/PR workflow alignment.", + ( + "Loop Engineering", + "agent loop", + "scheduler", + "event trigger", + "worktree", + "parallel", + "validator", + "verifier", + "persistent memory", + "GitHub", + "CI", + "issue", + "PR", + "\u8c03\u5ea6", + "\u5b9a\u65f6", + "\u4e8b\u4ef6\u89e6\u53d1", + "\u5e76\u884c", + "\u9a8c\u6536", + "\u8bb0\u5fc6", + ), ), - SkillDefinition("ReferenceModeOS", "reference", "Reference-image modes, DNA extraction, subject lock, edge and geometry constraints.", ("参考图", "reference", "lock")), - SkillDefinition("PromptOrchestrationEngine", "prompt", "PromptPacket orchestration for model-specific design prompts, reference locks, QA gates, and negative constraints.", ("prompt", "提示词", "PromptPacket")), SkillDefinition( "LoopPromptEngine", "prompt_loop", "Independent LoopPromptPack module for self-refine iteration, failed-result recovery, branch search, visual-result repair, and seamless video-loop prompts. It is a companion pack for PromptPacketV2, not a replacement.", - ("loop", "循环", "迭代", "自我检查", "失败修复", "无缝循环", "LoopPromptPack"), + ("loop", "iteration", "self critique", "failed-result recovery", "seamless loop", "LoopPromptPack", "\u5faa\u73af", "\u8fed\u4ee3", "\u81ea\u6211\u68c0\u67e5", "\u5931\u8d25\u4fee\u590d", "\u65e0\u7f1d\u5faa\u73af"), ), - SkillDefinition("EnvArtBoardOS", "environment", "Environmental art boards, spatial analysis diagrams, CAD/DWG/DXF geometry locks, layers, scale, and circulation logic.", ("环艺", "展板", "空间", "CAD", "DWG", "DXF")), - SkillDefinition("EnvArtCADMCPBridge", "environment_cad", "CADMCP bridge for environmental-art drawing channels: cad_health, DXF audit, DWG Core Console, AutoCAD COM, Tianzheng, semantic layers, and construction drawing QA.", ("cadmcp", "CADMCP", "DWG", "DXF", "AutoCAD", "天正", "施工图", "图层", "墙体", "门窗")), - SkillDefinition("brandVIos", "brand", "Brand VI, logo, city identity, dynamic marks, color, type, visual systems, and brand deliverables.", ("品牌", "VI", "logo", "标识", "城市标识")), - SkillDefinition("InfoVisOS", "infovis", "Information visualization, cultural diagrams, technical flows, maps, and data narratives.", ("信息可视化", "图谱", "流程图", "地图", "infovis")), - SkillDefinition("PPTOS", "presentation", "PowerPoint, deck, report visuals, and page narrative.", ("PPT", "deck", "汇报")), - SkillDefinition("WebDesignOS", "web", "Web, UI, Figma pages, interactions, and design specifications.", ("网页", "web", "UI", "Figma")), - SkillDefinition("UIDesignSpecOS", "ui_spec", "UI design specifications, DESIGN.md, token-first systems, and QA rubrics.", ("design.md", "规范", "token")), - SkillDefinition("LayeredBoardComposer", "delivery", "Layered PSD, PNG, PDF, ZIP, manifest, and module assembly.", ("分层", "PSD", "交付包", "zip")), - SkillDefinition("DeliveryFeedbackLayer", "feedback", "Delivery manifests, QA reports, feedback interpretation, patch writing, reward scoring, and training-loop updates.", ("反馈", "训练", "交付")), - SkillDefinition("TypographyDesignOS", "typography", "Typography posters, dynamic type, glyph rhythm, and layout experiments.", ("字体海报", "字体", "typography")), - SkillDefinition("PosterDesignOS", "poster", "Poster key visuals, poster series, campaign visuals, and visual-impact optimization.", ("海报", "主视觉", "poster")), - SkillDefinition("ShortDramaAIGC_OS", "video", "Short-drama AIGC, video storyboards, camera language, and generative video prompts.", ("短剧", "视频", "分镜", "Seedance")), - SkillDefinition("GeneralDesignOS", "general", "General design task coordination and fallback strategy.", ("设计", "方案")), - SkillDefinition("PhotographyOS", "photography", "Photography and retouching module: portrait preservation, product photography, composition optimization, Hanfu shoots, lighting plans, and post-production QA.", ("photography", "photo", "retouch", "portrait", "product photo", "hanfu", "摄影", "修图", "人像", "产品摄影", "精修", "汉服", "构图")), - SkillDefinition("LoRAStyleTrainingLibrary", "lora", "Standalone style dataset sandbox, LoRA training plans, and adapter manifests.", ("LoRA", "训练库", "风格训练")), + SkillDefinition("ReferenceModeOS", "reference", "Reference-image modes, DNA extraction, subject lock, edge and geometry constraints.", ("\u53c2\u8003\u56fe", "reference", "lock")), + SkillDefinition("PromptOrchestrationEngine", "prompt", "PromptPacket orchestration for model-specific design prompts, reference locks, QA gates, and negative constraints.", ("prompt", "\u63d0\u793a\u8bcd", "PromptPacket")), + SkillDefinition("EnvArtBoardOS", "environment", "Environmental art boards, spatial analysis diagrams, CAD/DWG/DXF geometry locks, layers, scale, and circulation logic.", ("\u73af\u827a", "\u5c55\u677f", "\u7a7a\u95f4", "CAD", "DWG", "DXF")), + SkillDefinition("EnvArtCADMCPBridge", "environment_cad", "CADMCP bridge for environmental-art drawing channels: cad_health, DXF audit, DWG Core Console, AutoCAD COM, Tianzheng, semantic layers, and construction drawing QA.", ("cadmcp", "CADMCP", "DWG", "DXF", "AutoCAD", "\u5929\u6b63", "\u65bd\u5de5\u56fe", "\u56fe\u5c42", "\u5899\u4f53", "\u95e8\u7a97")), + SkillDefinition("brandVIos", "brand", "Brand VI, logo, city identity, dynamic marks, color, type, visual systems, and brand deliverables.", ("\u54c1\u724c", "VI", "logo", "\u6807\u8bc6", "\u57ce\u5e02\u6807\u8bc6")), + SkillDefinition("InfoVisOS", "infovis", "Information visualization, cultural diagrams, technical flows, maps, and data narratives.", ("\u4fe1\u606f\u53ef\u89c6\u5316", "\u56fe\u89e3", "\u6d41\u7a0b\u56fe", "\u5730\u56fe", "infovis")), + SkillDefinition("PPTOS", "presentation", "PowerPoint, deck, report visuals, and page narrative.", ("PPT", "deck", "\u6c47\u62a5")), + SkillDefinition("WebDesignOS", "web", "Web, UI, Figma pages, interactions, and design specifications.", ("\u7f51\u9875", "web", "UI", "Figma")), + SkillDefinition("UIDesignSpecOS", "ui_spec", "UI design specifications, DESIGN.md, token-first systems, and QA rubrics.", ("design.md", "\u89c4\u8303", "token")), + SkillDefinition("LayeredBoardComposer", "delivery", "Layered PSD, PNG, PDF, ZIP, manifest, and module assembly.", ("\u5206\u5c42", "PSD", "\u4ea4\u4ed8\u5305", "zip")), + SkillDefinition("DeliveryFeedbackLayer", "feedback", "Delivery manifests, QA reports, feedback interpretation, patch writing, reward scoring, and training-loop updates.", ("\u53cd\u9988", "\u8bad\u7ec3", "\u4ea4\u4ed8")), + SkillDefinition("TypographyDesignOS", "typography", "Typography posters, dynamic type, glyph rhythm, and layout experiments.", ("\u5b57\u4f53\u6d77\u62a5", "\u5b57\u4f53", "typography")), + SkillDefinition("PosterDesignOS", "poster", "Poster key visuals, poster series, campaign visuals, and visual-impact optimization.", ("\u6d77\u62a5", "\u4e3b\u89c6\u89c9", "poster")), + SkillDefinition("ShortDramaAIGC_OS", "video", "Short-drama AIGC, video storyboards, camera language, and generative video prompts.", ("\u77ed\u5267", "\u89c6\u9891", "\u5206\u955c", "Seedance")), + SkillDefinition("GeneralDesignOS", "general", "General design task coordination and fallback strategy.", ("\u8bbe\u8ba1", "\u65b9\u6848")), + SkillDefinition("PhotographyOS", "photography", "Photography and retouching module: portrait preservation, product photography, composition optimization, Hanfu shoots, lighting plans, and post-production QA.", ("photography", "photo", "retouch", "portrait", "product photo", "hanfu", "\u6444\u5f71", "\u4fee\u56fe", "\u4eba\u50cf", "\u4ea7\u54c1\u6444\u5f71", "\u7cbe\u4fee", "\u6c49\u670d", "\u6784\u56fe")), + SkillDefinition("LoRAStyleTrainingLibrary", "lora", "Standalone style dataset sandbox, LoRA training plans, and adapter manifests.", ("LoRA", "\u8bad\u7ec3\u5e93", "\u98ce\u683c\u8bad\u7ec3")), ) diff --git a/app/management/github_manager.py b/app/management/github_manager.py index 60df62e..83c5f26 100644 --- a/app/management/github_manager.py +++ b/app/management/github_manager.py @@ -60,15 +60,15 @@ def status(self): } return json.dumps(payload, ensure_ascii=False, indent=2) - def release_plan(self, version="v2.0.0"): + def release_plan(self, version="v2.1.0"): branch = f"release/{version.lstrip('v')}" lines = [ f"# DESIGNOSFORGE {version} GitHub Release Plan", "", "1. Confirm the working tree is clean or intentionally staged.", f"2. Create a release branch: `git switch -c {branch}`.", - "3. Update skill metadata, source package version, README notes, and tests.", - "4. Run validation: skill quick_validate, source CLI smoke checks, and pytest.", + "3. Update skill metadata, source package version, README notes, Loop Engineering docs, and tests.", + "4. Run validation: skill quick_validate, source CLI smoke checks, compileall, source validator, and pytest.", f"5. Commit with: `release: designosforge {version}`.", f"6. Tag with: `git tag {version}` after tests pass.", "7. Push branch and tag to GitHub.", @@ -77,17 +77,21 @@ def release_plan(self, version="v2.0.0"): ] return "\n".join(lines) - def pr_template(self, version="v2.0.0"): + def pr_template(self, version="v2.1.0"): return "\n".join([ f"# Release DESIGNOSFORGE {version}", "", "## Summary", - "- Add v2.0 DesignKernel, DesignStateGraph, HybridRouter, PromptPacketV2, FailureMemoryBank, CriticEnsemble, ConstraintSolver, and candidate-direction search.", - "- Preserve DESIGNOSFORGE inference, GitHub management, image confirmation gates, and v1.5 quality controls.", + "- Add LoopEngineeringBlueprintBuilder and LoopEngineeringOS as a system-runtime layer for durable agent loops.", + "- Preserve PromptPacketV2 and LoopPromptPack as independent design and prompt-iteration contracts.", + "- Strengthen GitHub/CI/worktree workflow planning, executor/verifier split, persistent memory, and release validation.", "", "## Validation", "- [ ] Skill quick_validate passed", + "- [ ] Source skill validator passed", "- [ ] Source CLI smoke checks passed", + "- [ ] Loop Engineering CLI smoke check passed", + "- [ ] compileall passed", "- [ ] pytest passed", "- [ ] GitHub branch, tag, and release notes checked", "", diff --git a/codex_skill/designos-forge/SKILL.md b/codex_skill/designos-forge/SKILL.md index f763d92..76d5351 100644 --- a/codex_skill/designos-forge/SKILL.md +++ b/codex_skill/designos-forge/SKILL.md @@ -1,9 +1,9 @@ --- name: designos-forge -description: End-to-end local design-agent orchestration for DesignOS Forge v2.0.0 with a mathematical DesignKernel, PromptPacketV2, independent LoopPromptPack companion prompts, photography, EnvArt CADMCP, LoRA aesthetic memory, and GitHub workflows. Use for brand VI, city identity, logo systems, posters, typography, UI/web/Figma, PPT/decks, infovis, environmental art boards, CAD/DWG/DXF inspection, AutoCAD/Tianzheng routing, construction drawing QA, packaging, portrait retouching, product photography, Hanfu shoots, composition optimization, AIGC visual prompts, iterative loop prompts, failed-result recovery, seamless video loops, aesthetic quality gates, training-aware memory, project-context routing, anti-fragmentation control, text precision, UTF-8 checks, layout order, LoRA corpus planning, GitOps, GitHub management, or when the user says DESIGNOSFORGE, DesignOS, DesignForge, 超级设计智能体, 审美升级, 画面脏乱, 细碎感, 提示词精准, 乱码, 排版秩序, LoRA训练, 摄影, 修图, 环艺, CADMCP, 城市标识系统, loop提示词, 循环提示词, 无缝循环视频, 数学算法升级. +description: End-to-end local design-agent orchestration for DesignOS Forge v2.1.0 with a mathematical DesignKernel, DesignMathEngine, PromptPacketV2, independent LoopPromptPack, LoopEngineeringOS, photography, EnvArt CADMCP, LoRA aesthetic memory, and GitHub workflows. Use for brand VI, city identity, logo systems, posters, typography, UI/web/Figma, PPT/decks, infovis, environmental art boards, CAD/DWG/DXF inspection, AutoCAD/Tianzheng routing, construction drawing QA, packaging, portrait retouching, product photography, Hanfu shoots, composition optimization, AIGC visual prompts, iterative loop prompts, failed-result recovery, seamless video loops, Loop Engineering, scheduler/worktree/validator/persistent-memory workflows, aesthetic quality gates, training-aware memory, project-context routing, anti-fragmentation control, text precision, UTF-8 checks, layout order, LoRA corpus planning, GitOps, GitHub management, or when the user says DESIGNOSFORGE, DesignOS, DesignForge, 调用DesignForge, 超级设计智能体, 审美升级, 画面脏乱, 细碎感, 提示词精准, 乱码, 排版秩序, LoRA训练, 摄影, 修图, 环艺, CADMCP, 城市标识系统, loop提示词, 循环提示词, 无缝循环视频, 数学算法升级, Loop Engineering. --- -# DesignOS Forge v2.0.0 +# DesignOS Forge v2.1.0 ## Core Rule @@ -13,9 +13,9 @@ When triggered, explicitly state: 正在调用 DESIGNOSFORGE。 ``` -Treat DesignOS Forge as a design-progress partner, not a one-shot factory. For open or high-stakes work, guide the user through briefing, strategy, exploration, refinement, validation, and then delivery. +Treat DesignOS Forge as a design-progress partner, not a one-shot factory. For open or high-stakes work, guide the user through briefing, strategy, exploration, refinement, validation, and delivery. -Use the v2.0 mathematical environment before execution: parse intent, infer project context, retrieve aesthetic memory, build constraints, route through the strongest capability, rank candidate directions, run critic aggregation, and expose `math_trace` when the user asks why the system chose a path. +Use the v2.1 mathematical environment before execution: parse intent, infer project context, retrieve aesthetic memory, build constraints, route through the strongest capability, rank candidate directions, run critic aggregation, expose `math_trace` when the user asks why, and activate Loop Engineering when the task must run as a durable workflow. Read: @@ -23,6 +23,7 @@ Read: - `references/github-management.md` for Git, GitHub, branch, tag, PR, release, CI, and version-upgrade work. - `references/aesthetic-prompt-governance.md` for aesthetics, dirty or fragmented visuals, prompt richness, text precision, mojibake, layout order, redundant mechanisms, and LoopPromptPack governance. - `references/loop-prompt-pack.md` for the standalone loop prompt scheme, loop types, iteration rules, and seamless video-loop prompts. +- `references/loop-engineering.md` for scheduler, worktree isolation, skill context, external connectors, executor/verifier split, persistent memory, and durable loop state. - `references/lora-aesthetic-space.md` for LoRA training, case images, reference images, aesthetic corpus, style classification, project context, academic competition, Culture China, photography, and domain classification. Official wake command: @@ -33,9 +34,9 @@ Official wake command: When this command appears by itself, introduce DesignForge, explain core capabilities, usage patterns, reference-image mode, self-update loop, and delivery commands. Do not run generation or delivery for the wake command alone. -## v2 Mathematical Kernel +## v2.1 Mathematical Kernel -DESIGNOSFORGE v2.0 uses `DesignKernel` as the default reasoning core: +DESIGNOSFORGE v2.1 uses `DesignKernel` as the default reasoning core: 1. `SemanticIntentParser`: mixed Chinese/Latin intent parsing with domain, project-context, style-axis, delivery-mode, hard-requirement, and risk extraction. 2. `TextVectorizer`: Latin words plus Chinese character, bigram, and trigram features. @@ -47,12 +48,7 @@ DESIGNOSFORGE v2.0 uses `DesignKernel` as the default reasoning core: 8. `FailureMemoryBank`: previous failed directions retrieved by vector similarity plus domain bonus. 9. `PromptPacketV2Builder`: final design contract with memory, candidates, critics, constraints, tool plan, failure memory, and `math_trace`. 10. `LoopPromptPackBuilder`: independent companion prompt scheme for self-refine loops, failed-result recovery, branch search, visual-result repair, and seamless video loops. It never replaces PromptPacketV2. - -For algorithm inspection: - -```powershell -py -m app.cli kernel math-audit "为安徽省钢城马鞍山市设计城市标识系统logo,要求现代、公共文化传播、不要堆砌地标" -``` +11. `LoopEngineeringBlueprintBuilder`: system-runtime blueprint for scheduler, worktree isolation, skill context, external connectors, validation gate, persistent memory, handoff, and stop conditions. It never replaces LoopPromptPack. ## Project Contexts @@ -86,6 +82,10 @@ When generating prompts or design contracts, output a complete PromptPacketV2 wi - revision protocol - generation policy +Do not generate, edit, or render final visuals unless the user explicitly confirms. Confirmation examples: `确认生图`, `确认出图`, `可以生图`, `可以生成`, `approve image`. + +## LoopPromptPack Rules + LoopPromptPack is separate from PromptPacketV2. When the user asks for loop, 循环, 迭代, 自我检查, 失败修复, 多方案分支, visual-result repair, or seamless video loop prompts, use `LoopPromptPackBuilder` or: ```powershell @@ -94,10 +94,6 @@ py -m app.cli kernel loop-prompt "..." Produce an independent companion pack. Do not remove, replace, or rewrite the PromptPacketV2 contract. -Do not generate, edit, or render final visuals unless the user explicitly confirms. Confirmation examples: `确认生图`, `确认出图`, `可以生图`, `可以生成`, `approve image`. - -## LoopPromptPack Rules - LoopPromptPack supports: - `self_refine_loop`: draft, critique, revise, and rescore a prompt. @@ -115,12 +111,57 @@ Loop rules: - Stop when the target quality passes, no meaningful revision remains, a failure repeats, the user accepts the result, or max iterations are reached. - Write rejected patterns to failure memory when the user rejects a direction. +## Loop Engineering Rules + +LoopEngineeringOS is separate from LoopPromptPack. Use it when the user asks for Loop Engineering, durable agent loops, project-following workflows, GitHub/CI/issue/PR monitoring, scheduled work, multi-agent execution, worktree isolation, validator/verifier checks, or persistent memory. + +Use: + +```powershell +py -m app.cli kernel loop-engineering "Loop Engineering 调度 issue CI,worktree 并行隔离,validator 验收,写入长期记忆" +``` + +Every Loop Engineering plan must answer: + +1. who wakes the loop +2. how parallel agents avoid collisions +3. how the agent knows project habits +4. what external systems it can touch +5. who validates the result +6. how it remembers yesterday + +Runtime requirements: + +- scheduler or trigger is explicit +- parallel work uses worktree/sandbox isolation when edits can overlap +- required skills and project rules are loaded before execution +- external side effects are logged +- executor and verifier are split +- durable memory is written to repository files, PR body, issue, or delivery manifest +- stop conditions and human handoff conditions are explicit + +Principle: the model may forget, but the repository must not. + +## Capability Call Table + +| User intent | Primary route | Required output | Validation | +| --- | --- | --- | --- | +| General design strategy | `DesignKernel` | `PromptPacketV2` | route math, critic aggregation, constraints | +| Iterative prompt refinement | `LoopPromptEngine` | `LoopPromptPack` | one-axis iteration, stop conditions, failure memory | +| Durable agent loop | `LoopEngineeringOS` | `LoopEngineeringBlueprint` | scheduler, worktree isolation, verifier split, memory | +| Brand, VI, city identity | `brandVIos` | mark system direction and prompt packet | grid derivation, dynamic system, no random landmarks | +| Academic infovis board | `InfoVisOS` / `LayeredBoardComposer` | board strategy and modules | thesis hierarchy, evidence modules, text accuracy | +| EnvArt/CAD production | `EnvArtCADMCPBridge` | CAD-aware plan or prompt packet | CAD health, DXF audit, geometry locks | +| Photography/retouching | `PhotographyOS` | edit or shoot plan | identity preservation, light direction, artifact check | +| GitHub/release work | `GitOpsManager` / `GitHubManager` | release plan or PR body | compileall, tests, source validator, CI/PR checks | + ## Routing Use the closest route: -- `DesignKernel`: v2 mathematical orchestration and PromptPacketV2. +- `DesignKernel`: v2.1 mathematical orchestration and PromptPacketV2. - `LoopPromptEngine`: independent LoopPromptPack companion prompts for iterative refinement, failed-result recovery, branch exploration, visual-result repair, and seamless video loops. +- `LoopEngineeringOS`: durable workflow runtime for scheduler, worktree isolation, skill context, external connectors, validation gate, persistent memory, and handoff. - `DesignMathEngine`: vector scoring, route probability, memory similarity, Pareto/TOPSIS, and constraint penalty. - `brandVIos`: brand VI, logo, marks, city identity, visual identity systems. - `TypographyDesignOS`: typography posters, type systems, glyph rhythm. @@ -199,14 +240,15 @@ For source checks: ```powershell $env:PYTHONPATH='.' +$env:PYTHONUTF8='1' py -m app.cli capabilities -py -m app.cli kernel plan "为安徽省钢城马鞍山市设计城市标识系统logo,要求现代、公共文化传播、不要堆砌地标" +py -m app.cli kernel plan "为安徽省钢城马鞍山市设计城市标识系统 logo,要求现代、公共文化传播、不要堆砌地标。" py -m app.cli kernel loop-prompt "create a design prompt with three loop iterations and self critique" -py -m app.cli kernel loop-prompt "generate a seamless loop video prompt; first and last frame must match" +py -m app.cli kernel loop-engineering "Loop Engineering 调度 issue CI,worktree 并行隔离,validator 验收,写入长期记忆" py -m app.cli kernel math-audit "拯救课堂纪实照片,不要改变人物本来的面貌形象" py -m app.cli lora audit-corpus py -m app.cli lora build-memory-index -py -m app.cli envart-cad plan "用CADMCP审核环艺DWG平面并生成展板分析图提示词" +py -m app.cli github release-plan --version v2.1.0 ``` ## Output Contract diff --git a/codex_skill/designos-forge/agents/openai.yaml b/codex_skill/designos-forge/agents/openai.yaml index 9fb9798..fcd7178 100644 --- a/codex_skill/designos-forge/agents/openai.yaml +++ b/codex_skill/designos-forge/agents/openai.yaml @@ -1,7 +1,7 @@ interface: display_name: "DesignOS Forge" - short_description: "DesignOS Forge v2.0.0 mathematical DesignKernel for design routing, PromptPacketV2, LoopPromptPack, memory, photography, EnvArt CADMCP, LoRA, and GitHub orchestration" - default_prompt: "Use $designos-forge to route this design request through the v2.0 DesignKernel: semantic vector parsing, softmax route probability, aesthetic memory similarity, constraint penalty, Pareto/TOPSIS candidate ranking, critic aggregation, PromptPacketV2, independent LoopPromptPack companion prompts when iteration or seamless loops are requested, EnvArt CADMCP channel selection, photography identity locks, LoRA corpus planning, prompt precision, text/encoding health, and GitHub/GitOps management." + short_description: "DesignOS Forge v2.1.0 mathematical DesignKernel with PromptPacketV2, LoopPromptPack, LoopEngineeringOS, memory, photography, EnvArt CADMCP, LoRA, and GitHub orchestration" + default_prompt: "Use $designos-forge to route this design request through the v2.1 DesignKernel: semantic vector parsing, softmax route probability, aesthetic memory similarity, constraint penalty, Pareto/TOPSIS candidate ranking, critic aggregation, PromptPacketV2, independent LoopPromptPack companion prompts, LoopEngineeringBlueprint when a durable system loop is needed, EnvArt CADMCP channel selection, photography identity locks, LoRA corpus planning, prompt precision, text/encoding health, and GitHub/GitOps management." policy: allow_implicit_invocation: true diff --git a/codex_skill/designos-forge/references/aesthetic-prompt-governance.md b/codex_skill/designos-forge/references/aesthetic-prompt-governance.md index d539508..86b9ec1 100644 --- a/codex_skill/designos-forge/references/aesthetic-prompt-governance.md +++ b/codex_skill/designos-forge/references/aesthetic-prompt-governance.md @@ -92,6 +92,36 @@ Required loop types: The loop must change one axis at a time and stop when the quality target passes, no meaningful revision remains, the same failure repeats, the user accepts the result, or the maximum iteration count is reached. +## LoopEngineeringBlueprint Contract + +LoopEngineeringBlueprint is a separate system-runtime layer. It does not replace PromptPacketV2 or LoopPromptPack. + +Use LoopEngineeringBlueprint when the task needs a running workflow with scheduler, worktree isolation, skill context, external connectors, validation gates, persistent memory, handoff, and stop conditions. + +LoopEngineeringBlueprint must include: + +```text +schema_version +packet_type = LoopEngineeringBlueprint +relationship_to_loop_prompt_pack +activation +six_question_contract +runtime_blueprint.scheduler +runtime_blueprint.parallel_isolation +runtime_blueprint.skill_context +runtime_blueprint.external_connectors +runtime_blueprint.validation_gate +runtime_blueprint.persistent_memory +agent_topology +state_schema +handoff_contract +failure_controls +prompt_scaffold +export_policy +``` + +For design work, the verifier must enforce the aesthetic gates in this document. For GitHub or engineering work, the verifier must also run compile/tests/source validation before accepting the loop iteration. + ## Rewrite Pattern Replace vague visual language with controlled structure: diff --git a/codex_skill/designos-forge/references/environment-toolchain.md b/codex_skill/designos-forge/references/environment-toolchain.md index a4daf30..819d3e6 100644 --- a/codex_skill/designos-forge/references/environment-toolchain.md +++ b/codex_skill/designos-forge/references/environment-toolchain.md @@ -6,14 +6,7 @@ - Installed skill: `C:\Users\taojian\.codex\skills\designos-forge` - Source package: `D:\DESIGNOSFORGE\DESIGNOSFORGE_v1.4_source_for_codex` -Prefer the bundled runtime for document, slide, spreadsheet, PDF, image, and browser automation work: - -```text -C:\Users\taojian\.cache\codex-runtimes\codex-primary-runtime\dependencies\python\python.exe -C:\Users\taojian\.cache\codex-runtimes\codex-primary-runtime\dependencies\node\bin\node.exe -``` - -On this Windows environment, `python.exe` may resolve to the Windows Store shim. Use `py -3` or the bundled runtime, and set `PYTHONUTF8=1` before validating Chinese skill files. +Prefer the bundled runtime for document, slide, spreadsheet, PDF, image, and browser automation work when needed. On this Windows environment, `python.exe` may resolve to the Windows Store shim. Use `py -3` or the bundled runtime, and set `PYTHONUTF8=1` before validating Chinese skill files. ## Audit Command @@ -29,12 +22,13 @@ The script returns JSON with detected skill folders, source package locations, P - Brand VI and formal VI boards: use `brand-vi-board-system` when competition-grade boards, manuals, brand strategy, or formal VI output is requested. - Mathematical design routing: use `DesignKernel` and `DesignMathEngine` before visual generation when routing, memory, constraints, candidates, or critic decisions matter. +- Loop Engineering: use `LoopEngineeringOS` when the work needs scheduler, worktree isolation, connector boundaries, executor/verifier split, and persistent memory. - Environmental art, spatial boards, exhibition boards, maps, and CAD-based visual analysis: use `envart-analysis-board-agent`, `cad-drawing-control`, and `cad-project-drawing-methodology` as a fused workflow. For CAD/DWG/DXF tasks, run CADMCP readiness first, then preserve source geometry, semantic layers, wall/opening topology, dimensions, title block, and drawing units before board styling or image2 prompt generation. - UI/web/product design: use `ui-design-spec`; use Browser for localhost verification and Figma for design files, components, diagrams, libraries, or FigJam. - Image prompts and visual prompt engineering: use `image-prompt-crafter`, `gpt-image-2-style-library`, `prompt-engineering`, or `zh-prompt-library`. - Real bitmap generation or editing: use image generation/editing only after DESIGNOSFORGE's confirmation gate passes. - PPT/decks, documents, and spreadsheets: use Presentations, Documents, or Spreadsheets capabilities and render/verify outputs before delivery. -- GitHub, GitOps, registry sync, and source publishing: use GitHub skills, `references/github-management.md`, the v2.0 `github` CLI, or the `gitops` CLI only when code/source state is part of the request. +- GitHub, GitOps, registry sync, and source publishing: use GitHub skills, `references/github-management.md`, the v2.1 `github` CLI, or the `gitops` CLI only when code/source state is part of the request. - Supabase-backed apps: use Supabase capabilities for schema, auth, storage, vectors, and SSR integration tasks. ## Runtime Validation @@ -52,7 +46,7 @@ Validate the source package: $env:PYTHONPATH='.' $env:PYTHONUTF8='1' py -3 -m app.cli capabilities -py -3 -m app.cli kernel math-audit '为安徽省钢城马鞍山市设计城市标识系统logo,要求现代、公共文化传播、不要堆砌地标' +py -3 -m app.cli kernel loop-engineering 'Loop Engineering 调度 issue CI,worktree 并行隔离,validator 验收,写入长期记忆' py -3 -m app.cli github status py -3 -m app.cli quality audit '高级 大气 细碎 脏乱 生成一张海报' ``` diff --git a/codex_skill/designos-forge/references/github-management.md b/codex_skill/designos-forge/references/github-management.md index 3197e5a..ea3e8f3 100644 --- a/codex_skill/designos-forge/references/github-management.md +++ b/codex_skill/designos-forge/references/github-management.md @@ -8,24 +8,25 @@ Use semantic versioning with explicit release lanes: - `v1.5.x`: aesthetic quality gates, text/encoding health, layout order, and redundancy governance. - `v1.6.x`: training-aware memory, project-context routing, photography, EnvArt CADMCP, and PromptPacket v1.6. - `v2.0.0`: mathematical DesignKernel, PromptPacketV2, route probability, memory similarity, candidate optimization, critic aggregation, and `math_trace`. +- `v2.1.x`: Loop Engineering, LoopEngineeringOS, durable loop runtime, GitHub/CI/worktree workflow planning, validation split, and persistent memory. ## Branch, Tag, and Release Rules - Use `main` for stable releases. -- Use `release/` for release candidates, such as `release/2.0.0`. +- Use `release/` for release candidates, such as `release/2.1.0`. - Use `feat/` for new capabilities. - Use `fix/` for defects. -- Use annotated release tags when possible: `v2.0.0`. +- Use annotated release tags when possible: `v2.1.0`. - Keep each release PR focused on one capability layer: skill metadata, runtime code, CLI management, tests, or packaging. ## GitHub Workflow 1. Check local state: `python -m app.cli github status`. -2. Update skill metadata, references, source package version, tests, and README notes. -3. Run validation: skill quick_validate, CLI smoke checks, compileall, source validator, and pytest when available. -4. Commit with `feat: upgrade designosforge to v2 design kernel`. +2. Update skill metadata, references, source package version, tests, README notes, release notes, and PR body. +3. Run validation: skill quick_validate, source CLI smoke checks, compileall, source validator, and pytest. +4. Commit with `feat: add loop engineering runtime`. 5. Push the branch and open a draft PR or push directly to `main` when explicitly requested. -6. Tag `v2.0.0`. +6. Tag `v2.1.0` after tests pass and the release scope is accepted. 7. Attach validation evidence and rollback notes. Use the GitHub plugin for repository, issue, PR, comment, label, release, and connector-backed write operations. Use local `git` and `gh` only for branch discovery, commits, pushes, current branch PR lookup, GitHub Actions logs, and gaps not covered by the connector. @@ -38,9 +39,9 @@ From the source package root: $env:PYTHONPATH='.' $env:PYTHONUTF8='1' py -3 -m app.cli github status -py -3 -m app.cli github release-plan --version v2.0.0 -py -3 -m app.cli github pr-template --version v2.0.0 -py -3 -m app.cli kernel math-audit "为安徽省钢城马鞍山市设计城市标识系统logo,要求现代、公共文化传播、不要堆砌地标" +py -3 -m app.cli github release-plan --version v2.1.0 +py -3 -m app.cli github pr-template --version v2.1.0 +py -3 -m app.cli kernel loop-engineering "Loop Engineering 调度 issue CI,worktree 并行隔离,validator 验收,写入长期记忆" ``` Do not create remotes, push, or publish releases without an explicit repository target confirmation. diff --git a/codex_skill/designos-forge/references/loop-engineering.md b/codex_skill/designos-forge/references/loop-engineering.md new file mode 100644 index 0000000..5177ba6 --- /dev/null +++ b/codex_skill/designos-forge/references/loop-engineering.md @@ -0,0 +1,63 @@ +# Loop Engineering Reference + +Loop Engineering is the system-runtime layer for durable agent workflows. It is separate from LoopPromptPack. + +Use LoopEngineeringOS when the user asks for: + +- Loop Engineering +- long-running agent loops +- scheduler, cron, daily checks, event triggers +- GitHub issue, PR, CI, test failure, or release-monitor loops +- multiple agents, parallel work, worktree isolation +- validator, verifier, review, acceptance gate +- persistent memory, loop state, project-following workflows + +## Six Questions + +Every LoopEngineeringBlueprint must answer: + +1. Who wakes the loop? + - manual, scheduled, event, validation failure, or goal-until-done trigger. +2. How do parallel agents avoid collisions? + - worktree/sandbox per executor, path ownership, merge gate, conflict check. +3. How does the agent know project habits? + - required skills, project rules, no-touch paths, naming conventions, known traps. +4. What external systems can it touch? + - local files, Git, GitHub, issues, PRs, CI, browser QA, CAD MCP, image tools, database, notifications. +5. Who validates the result? + - executor/verifier split, deterministic tests first, critic/reviewer checks, human review threshold. +6. How does it remember yesterday? + - state file, PR body, issue, failure memory, delivery manifest, next wake condition. + +## Runtime Requirements + +- Scheduler is explicit. +- Parallel editing uses worktree isolation when paths may overlap. +- Skills and project context are loaded before execution. +- External side effects are logged. +- The executor does not serve as the only validator. +- Stop conditions and human handoff rules are explicit. +- Persistent memory is written after each iteration. + +## CLI + +```powershell +py -m app.cli kernel loop-engineering "Loop Engineering 调度 issue CI,worktree 并行隔离,validator 验收,写入长期记忆" +``` + +## Output Contract + +```text +packet_type = LoopEngineeringBlueprint +runtime_blueprint.scheduler +runtime_blueprint.parallel_isolation +runtime_blueprint.skill_context +runtime_blueprint.external_connectors +runtime_blueprint.validation_gate +runtime_blueprint.persistent_memory +agent_topology +state_schema +handoff_contract +failure_controls +prompt_scaffold +``` diff --git a/codex_skill/designos-forge/references/loop-prompt-pack.md b/codex_skill/designos-forge/references/loop-prompt-pack.md index 597f9f0..42aaef8 100644 --- a/codex_skill/designos-forge/references/loop-prompt-pack.md +++ b/codex_skill/designos-forge/references/loop-prompt-pack.md @@ -4,12 +4,22 @@ LoopPromptPack is an independent companion prompt scheme for DESIGNOSFORGE. It d Use it when the user asks for: -- loop, 循环, 闭环, 迭代, 多轮, 自我检查, 继续优化 -- failed-result recovery: 失败, 不成功, 不算数, 好丑, 跑偏, 重来 +- loop, iteration, self critique, self-check, continue optimizing +- 循环, 闭环, 迭代, 多轮, 自我检查, 继续优化 +- failed-result recovery: 失败, 不成功, 不算数, 当做没发生, 好丑, 跑偏, 重来 - branch exploration: 多方案, 分支, 候选, 方案比较 - visual result repair: 改图, 修图, 拯救, 保留, 不要改变 - seamless video loops: 无缝循环, 首尾一致, loop video, seamless, closed camera path +## Relationship To Loop Engineering + +LoopPromptPack controls repeated prompt attempts. LoopEngineeringBlueprint controls the system runtime around a loop. + +Use: + +- `kernel loop-prompt` for prompt iteration. +- `kernel loop-engineering` for scheduler, worktree isolation, connectors, validation, and persistent memory. + ## Required Fields ```text diff --git a/docs/CODEX_INSTALL.md b/docs/CODEX_INSTALL.md index 6fb5727..db9c303 100644 --- a/docs/CODEX_INSTALL.md +++ b/docs/CODEX_INSTALL.md @@ -29,10 +29,18 @@ In Codex, say: or ask for a design workflow such as: ```text -为安徽省钢城马鞍山市设计城市标识系统logo,要求现代、公共文化传播、不要堆砌地标。 +为安徽省钢城马鞍山市设计城市标识系统 logo,要求现代、公共文化传播、不要堆砌地标。 ``` -DESIGNOSFORGE v2.0.0 uses a mathematical DesignKernel, PromptPacketV2, aesthetic quality gates, training-aware case memory, failure memory, project-context routing, EnvArt CADMCP source-fidelity routing, photography identity locks, image-generation confirmation gates, text/encoding health checks, and GitHub/GitOps release planning. +DESIGNOSFORGE v2.1.0 uses a mathematical DesignKernel, PromptPacketV2, independent LoopPromptPack, LoopEngineeringOS, aesthetic quality gates, training-aware case memory, failure memory, project-context routing, EnvArt CADMCP source-fidelity routing, photography identity locks, image-generation confirmation gates, text/encoding health checks, and GitHub/GitOps release planning. + +## Loop Engineering Smoke Test + +Use this when you need to verify durable loop routing: + +```powershell +py -m app.cli kernel loop-engineering "Loop Engineering 调度 issue CI,worktree 并行隔离,validator 验收,写入长期记忆" +``` ## Math Audit diff --git a/docs/LOOP_ENGINEERING.md b/docs/LOOP_ENGINEERING.md new file mode 100644 index 0000000..4550753 --- /dev/null +++ b/docs/LOOP_ENGINEERING.md @@ -0,0 +1,101 @@ +# Loop Engineering + +Loop Engineering upgrades a loop from repeated prompting into a running system. In DESIGNOSFORGE v2.1.0, `LoopPromptPack` remains the prompt-iteration layer, while `LoopEngineeringBlueprint` defines the runtime around it. + +## The Six Questions + +Every serious loop must answer six questions before it runs: + +1. Who wakes the loop? + - manual trigger + - scheduled trigger + - event trigger + - validation-failure trigger + - goal-until-done trigger + +2. How do parallel agents avoid collisions? + - use one worktree or sandbox per executor when edits can overlap + - declare file ownership before editing + - merge through review rather than direct overwrite + - run conflict gates before accepting output + +3. How does the agent know project habits? + - load the right skills + - read project rules and no-touch paths + - keep naming conventions and known pitfalls outside the chat + - treat skills as long-term memory, not one-off prompt text + +4. What external systems can it touch? + - local files + - Git and GitHub + - issues, PRs, CI, tests + - browser QA, CAD MCP, image tools, or databases when relevant + - all side effects must be logged + +5. Who validates the result? + - split executor and verifier roles + - run deterministic checks first + - use critic or reviewer agents for subjective quality + - ask for human review when correctness cannot be proven + +6. How does it remember yesterday? + - write a loop state file + - record decisions, failures, confirmed facts, and next wake conditions + - update failure memory for rejected directions + - keep durable state in the repository or issue system + +Principle: the model may forget, but the repository must not. + +## Runtime Blueprint + +`LoopEngineeringBlueprint` always contains: + +```json +{ + "schema_version": "2.1.0-loop-engineering.1", + "packet_type": "LoopEngineeringBlueprint", + "relationship_to_loop_prompt_pack": {}, + "activation": {}, + "six_question_contract": [], + "runtime_blueprint": { + "scheduler": {}, + "parallel_isolation": {}, + "skill_context": {}, + "external_connectors": {}, + "validation_gate": {}, + "persistent_memory": {} + }, + "agent_topology": {}, + "state_schema": {}, + "handoff_contract": {}, + "failure_controls": [], + "prompt_scaffold": {}, + "export_policy": {} +} +``` + +## Runtime Roles + +- `scheduler`: wakes the loop and decides whether work continues. +- `executor`: performs route-specific work. +- `verifier`: runs tests, audits, critic checks, and acceptance gates. +- `memory_writer`: persists state, failures, and handoff notes. +- `merge_or_handoff`: merges accepted work or asks for human review. + +## Practical Call Table + +| Trigger | Runtime mode | Required layer | +| --- | --- | --- | +| `issue`, `CI`, `PR`, `GitHub` | event-connected dev loop | Git/GitHub connector, tests, verifier | +| `worktree`, `parallel`, `多个 Agent` | parallel loop | worktree isolation and ownership gate | +| `每天`, `定时`, `30 minutes` | scheduled monitor loop | scheduler and memory file | +| `validator`, `verifier`, `验收` | validation loop | executor/verifier split | +| `长期记忆`, `persistent memory` | durable loop | state file and failure memory | + +## CLI + +```powershell +py -m app.cli kernel loop-engineering "Loop Engineering 调度 issue CI,worktree 并行隔离,validator 验收,写入长期记忆" +``` + +Use `kernel loop-prompt` when you only need a prompt iteration pack. Use `kernel loop-engineering` when the loop must operate as a system. diff --git a/docs/LOOP_PROMPT_PACK.md b/docs/LOOP_PROMPT_PACK.md index c7a80e2..d4ae6e2 100644 --- a/docs/LOOP_PROMPT_PACK.md +++ b/docs/LOOP_PROMPT_PACK.md @@ -1,24 +1,26 @@ # LoopPromptPack Companion Protocol -LoopPromptPack is an independent prompt-engineering scheme for DESIGNOSFORGE v2.0. It does not replace PromptPacketV2. It runs beside it when a task needs iteration, failed-result recovery, branch exploration, visual-result repair, or seamless video-loop prompts. +LoopPromptPack is an independent prompt-engineering scheme for DESIGNOSFORGE v2.1. It does not replace PromptPacketV2. -## Why It Exists +Use it when a task needs prompt iteration, failed-result recovery, branch exploration, visual-result repair, or seamless video-loop prompts. -PromptPacketV2 is the main design contract: route, memory, candidates, constraints, critics, tool plan, and generation policy. +LoopPromptPack is not the same as Loop Engineering: -LoopPromptPack is a loop controller: it defines how to run repeated prompt attempts safely, how to critique each iteration, how to stop, and how to write failure knowledge back into memory. +- `LoopPromptPack` controls repeated prompt attempts. +- `LoopEngineeringBlueprint` controls the system runtime around a loop: scheduler, worktree isolation, skills, connectors, validation, and memory. ## Activation LoopPromptPack activates when the brief contains signals such as: -- loop, seamless, video loop, first and last frame, closed camera path +- loop, iteration, self critique, self-check, continue optimizing - 循环, 闭环, 迭代, 多轮, 自我检查, 继续优化 -- 失败, 不成功, 不算数, 好丑, 跑偏, 重来 -- 改图, 修图, 拯救, 保留, 不要改变 -- 多方案, 分支, 候选, 方案比较 - -When no loop signal exists, the pack remains available but inactive. +- failed, not successful, does not count, redo +- 失败, 不成功, 不算数, 当做没发生, 好丑, 跑偏, 重来 +- edit image, retouch, repair, preserve, do not change +- 改图, 修图, 拯救, 保留, 不要改变, 参考图 +- seamless, loop video, first and last frame, closed camera path +- 无缝循环, 循环视频, 首尾一致, 镜头循环 ## Loop Types @@ -48,7 +50,7 @@ Every LoopPromptPack returns: ```json { - "schema_version": "2.0.0-loop.1", + "schema_version": "2.1.0-loop.1", "packet_type": "LoopPromptPack", "relationship_to_prompt_packet_v2": { "mode": "independent_companion_pack", @@ -63,38 +65,21 @@ Every LoopPromptPack returns: } ``` -## State Model - -Each iteration must preserve: - -- `iteration` -- stable original brief -- current draft prompt -- critique findings -- revision delta -- quality score -- stop or continue decision - -The loop must change one axis at a time. This prevents prompt drift and avoids turning critique into an uncontrolled rewrite. - -## Stop Conditions - -A loop should stop when: - -- the score reaches the target threshold -- no material revision delta remains -- the same failure repeats -- the user accepts the direction -- the maximum iteration count is reached +## Iteration Rules -Default maximum iterations: `3`. +- Preserve the stable original brief. +- Change one axis per iteration. +- Output state, critique, revision delta, revised prompt, score, and stop-or-continue decision. +- Keep visible text exact. +- Stop on score pass, no meaningful revision delta, repeated failure, user acceptance, or max iterations. +- Default max iterations: `3`. ## CLI ```powershell py -m app.cli kernel loop-prompt "create a design prompt with three loop iterations and self critique" py -m app.cli kernel loop-prompt "generate a seamless loop video prompt; first and last frame must match" -py -m app.cli kernel prompt-packet "make a logo" +py -m app.cli kernel loop-engineering "Loop Engineering 调度 issue CI,worktree 并行隔离,validator 验收,写入长期记忆" ``` -The third command still returns PromptPacketV2. It does not become a LoopPromptPack. +Use `kernel loop-prompt` for prompt iteration. Use `kernel loop-engineering` when the loop must become a running system. diff --git a/docs/PR_BODY_v2.1.0.md b/docs/PR_BODY_v2.1.0.md new file mode 100644 index 0000000..580d0d0 --- /dev/null +++ b/docs/PR_BODY_v2.1.0.md @@ -0,0 +1,28 @@ +# Release DESIGNOSFORGE v2.1.0 + +## Summary + +- Add Loop Engineering as a system-runtime layer for long-running agent loops. +- Add `LoopEngineeringBlueprintBuilder` and `LoopEngineeringOS`. +- Add `kernel loop-engineering` CLI export. +- Document the six-question loop contract: scheduler, isolation, skill context, connectors, validation, and memory. +- Keep `PromptPacketV2` and `LoopPromptPack` independent and backward compatible. +- Strengthen GitHub/CI/worktree workflow planning and release validation. + +## Validation + +- [ ] `py -m compileall app tests tools` +- [ ] `py -m app.cli capabilities` +- [ ] `py -m app.cli kernel loop-engineering "Loop Engineering 调度 issue CI,worktree 并行隔离,validator 验收,写入长期记忆"` +- [ ] `py -m app.cli kernel loop-prompt "create a design prompt with three loop iterations and self critique"` +- [ ] `py -m pytest -q` +- [ ] `py tools\validate_source_skill.py` +- [ ] Skill quick_validate passed + +## Compatibility + +This is additive. Existing PromptPacketV2, LoopPromptPack, LoRA memory, EnvArt CADMCP, photography workflows, and GitHub management remain intact. + +## Rollback + +Revert the release commit or restore the previous tag. diff --git a/docs/RELEASE_NOTES_v2.1.0.md b/docs/RELEASE_NOTES_v2.1.0.md new file mode 100644 index 0000000..ec93c40 --- /dev/null +++ b/docs/RELEASE_NOTES_v2.1.0.md @@ -0,0 +1,30 @@ +# DESIGNOSFORGE v2.1.0 Release Notes + +DESIGNOSFORGE v2.1.0 introduces system-level Loop Engineering for long-running, tool-connected, validated agent workflows. + +## Highlights + +- Adds `LoopEngineeringBlueprintBuilder`. +- Adds `LoopEngineeringOS` to the capability and skill registry. +- Adds `kernel loop-engineering` CLI output. +- Extends `DesignKernelPlan` with a `loop_engineering` side channel. +- Keeps `PromptPacketV2` and `LoopPromptPack` independent and backward compatible. +- Defines six durable loop layers: scheduler, worktree isolation, skill context, external connectors, validation gate, and persistent memory. +- Strengthens GitHub/release planning around compile, source validation, CLI smoke checks, tests, PR notes, and rollback. + +## Validation + +```powershell +$env:PYTHONPATH='.' +$env:PYTHONUTF8='1' +py -m compileall app tests tools +py -m app.cli capabilities +py -m app.cli kernel loop-engineering "Loop Engineering 调度 issue CI,worktree 并行隔离,validator 验收,写入长期记忆" +py -m app.cli kernel loop-prompt "create a design prompt with three loop iterations and self critique" +py -m pytest -q +py tools\validate_source_skill.py +``` + +## Compatibility + +`LoopEngineeringBlueprint` is additive. It does not replace `PromptPacketV2` or `LoopPromptPack`. diff --git a/pyproject.toml b/pyproject.toml index 2e4b509..d8263ea 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,8 +4,8 @@ build-backend = "setuptools.build_meta" [project] name = "designosforge" -version = "2.0.0" -description = "DESIGNOSFORGE v2 source package for Codex with a mathematical design kernel, aesthetic memory, LoRA corpus planning, EnvArt CADMCP, photography, and GitHub management." +version = "2.1.0" +description = "DESIGNOSFORGE v2 source package for Codex with a mathematical design kernel, Loop Engineering, aesthetic memory, LoRA corpus planning, EnvArt CADMCP, photography, and GitHub management." requires-python = ">=3.10" [project.optional-dependencies] diff --git a/skills/DesignKernel/SKILL.md b/skills/DesignKernel/SKILL.md new file mode 100644 index 0000000..9ad7ccb --- /dev/null +++ b/skills/DesignKernel/SKILL.md @@ -0,0 +1,12 @@ +# DesignKernel + +Mathematical orchestration core for DESIGNOSFORGE v2.1.0. + +Use for intent parsing, project-context routing, aesthetic memory, constraints, candidate ranking, critic aggregation, PromptPacketV2, LoopPromptPack side channel, LoopEngineeringBlueprint side channel, and `math_trace`. + +Validation: + +- route probability is explicit +- constraints and risks are explicit +- candidate ranking is inspectable +- PromptPacketV2 remains the delivery contract diff --git a/skills/DesignMathEngine/SKILL.md b/skills/DesignMathEngine/SKILL.md new file mode 100644 index 0000000..cdbb94a --- /dev/null +++ b/skills/DesignMathEngine/SKILL.md @@ -0,0 +1,11 @@ +# DesignMathEngine + +Mathematical design layer for DESIGNOSFORGE v2.1.0. + +Use for mixed-language vectorization, cosine similarity, jaccard similarity, softmax routing, entropy, confidence margin, Pareto front, TOPSIS ranking, weighted utility, and constraint penalty. + +Validation: + +- expose formulas through `math_trace` +- keep scores normalized where needed +- do not make black-box taste claims without route or critic evidence diff --git a/skills/EnvArtCADMCPBridge/SKILL.md b/skills/EnvArtCADMCPBridge/SKILL.md new file mode 100644 index 0000000..738d825 --- /dev/null +++ b/skills/EnvArtCADMCPBridge/SKILL.md @@ -0,0 +1,12 @@ +# EnvArtCADMCPBridge + +CADMCP bridge for environmental-art and spatial-production workflows. + +Use for CAD health checks, DXF inspection/audit, DWG Core Console workflows, AutoCAD COM, Tianzheng component routing, semantic layers, geometry locks, and construction drawing QA. + +Rules: + +- preserve source geometry +- do not beautify away walls, openings, axes, dimensions, roads, or site boundaries +- place analysis overlays above locked base drawings +- validate with CAD/DXF audits when possible diff --git a/skills/LoopEngineeringOS/SKILL.md b/skills/LoopEngineeringOS/SKILL.md new file mode 100644 index 0000000..e65f3a3 --- /dev/null +++ b/skills/LoopEngineeringOS/SKILL.md @@ -0,0 +1,20 @@ +# LoopEngineeringOS + +System-runtime layer for durable agent loops. + +Use when a workflow needs scheduler, event triggers, GitHub/CI/issue/PR integration, multi-agent worktree isolation, executor/verifier split, persistent memory, and complete project-following behavior. + +Every loop must answer: + +- who wakes the loop +- how parallel agents avoid collisions +- how the agent knows project habits +- what external systems it can touch +- who validates the result +- how it remembers yesterday + +CLI: + +```powershell +py -m app.cli kernel loop-engineering "Loop Engineering 调度 issue CI,worktree 并行隔离,validator 验收,写入长期记忆" +``` diff --git a/skills/LoopPromptEngine/SKILL.md b/skills/LoopPromptEngine/SKILL.md new file mode 100644 index 0000000..24b2190 --- /dev/null +++ b/skills/LoopPromptEngine/SKILL.md @@ -0,0 +1,13 @@ +# LoopPromptEngine + +Independent LoopPromptPack companion prompt system. + +Use for self-refine iteration, failed-result recovery, branch search, visual-result repair, and seamless video-loop prompts. + +Rules: + +- do not replace PromptPacketV2 +- change one axis per iteration +- preserve hard constraints +- keep visible text exact +- stop on pass, repeated failure, user acceptance, or max iterations diff --git a/skills/PhotographyOS/SKILL.md b/skills/PhotographyOS/SKILL.md new file mode 100644 index 0000000..d8455af --- /dev/null +++ b/skills/PhotographyOS/SKILL.md @@ -0,0 +1,11 @@ +# PhotographyOS + +Photography and retouching module for portraits, documentary scenes, product photos, composition optimization, and Hanfu shoots. + +Rules: + +- preserve face identity, body anatomy, expression, clothing, and light direction +- keep skin texture natural +- separate local cleanup from global grading +- preserve product geometry, labels, material texture, and reflection +- do not hallucinate visible text or brand marks diff --git a/skills/skill_registry.json b/skills/skill_registry.json index f39774c..f814f98 100644 --- a/skills/skill_registry.json +++ b/skills/skill_registry.json @@ -1,8 +1,13 @@ { - "version": "1.4.0", + "version": "2.1.0", "skills": [ + "DesignKernel", + "DesignMathEngine", + "LoopEngineeringOS", + "LoopPromptEngine", "ReferenceModeOS", "PromptOrchestrationEngine", + "EnvArtCADMCPBridge", "EnvArtBoardOS", "brandVIos", "InfoVisOS", @@ -16,6 +21,7 @@ "PosterDesignOS", "ShortDramaAIGC_OS", "GeneralDesignOS", - "LoRAStyleTrainingLibrary" + "LoRAStyleTrainingLibrary", + "PhotographyOS" ] } diff --git a/tests/test_designosforge_core.py b/tests/test_designosforge_core.py index bd70548..a50970b 100644 --- a/tests/test_designosforge_core.py +++ b/tests/test_designosforge_core.py @@ -3,7 +3,7 @@ from app.core.aesthetic_quality import AestheticQualityGate from app.core.capabilities import capability_report from app.core.design_kernel import DesignKernel -from app.core.loop_prompt import LoopPromptPackBuilder +from app.core.loop_prompt import LoopEngineeringBlueprintBuilder, LoopPromptPackBuilder from app.core.prompt_packet import PROMPT_PACKET_SECTIONS, PromptPacketBuilder from app.core.skill_registry import SkillRegistry from app.core.task_router import TaskRouterAgent @@ -12,9 +12,12 @@ def test_capabilities_include_core_agents(): report = capability_report() - assert "DESIGNOSFORGE v2.0.0" in report + assert "DESIGNOSFORGE v2.1.0" in report assert "PromptPacketV2Builder" in report assert "LoopPromptEngine" in report + assert "LoopEngineeringOS" in report + assert "Capability Call Table" in report + assert "durable_agent_loop" in report assert "AestheticMemoryIndex" in report assert "GitOpsManager" in report assert "GitHubManager" in report @@ -24,6 +27,7 @@ def test_skill_registry_has_expected_skills(): registry = SkillRegistry() assert registry.has("brandVIos") assert registry.has("LoopPromptEngine") + assert registry.has("LoopEngineeringOS") assert registry.has("PhotographyOS") @@ -51,6 +55,27 @@ def test_loop_prompt_pack_is_independent_companion(): assert pack["loop_contract"]["loop_type"] == "self_refine_loop" +def test_loop_engineering_blueprint_answers_six_questions(): + blueprint = LoopEngineeringBlueprintBuilder().build( + "系统性革新升级 Loop Engineering:每天扫 CI,多个 Agent 用 worktree 并行,失败后写入记忆并由 verifier 验收" + ) + assert blueprint["packet_type"] == "LoopEngineeringBlueprint" + assert blueprint["activation"]["active"] is True + assert len(blueprint["six_question_contract"]) == 6 + runtime = blueprint["runtime_blueprint"] + for key in ( + "scheduler", + "parallel_isolation", + "skill_context", + "external_connectors", + "validation_gate", + "persistent_memory", + ): + assert key in runtime + assert runtime["parallel_isolation"]["isolation_mode"] == "git_worktree_per_agent" + assert runtime["validation_gate"]["executor_validator_split"] is True + + def test_kernel_exposes_loop_prompt_side_channel_for_video_loop(): plan = DesignKernel().plan("generate a seamless loop video prompt; first and last frame must match").to_dict() pack = plan["loop_prompt_pack"] @@ -61,10 +86,20 @@ def test_kernel_exposes_loop_prompt_side_channel_for_video_loop(): assert plan["prompt_packet_v2"]["packet_type"] == "PromptPacketV2" +def test_kernel_exposes_loop_engineering_side_channel(): + plan = DesignKernel().plan("Loop Engineering 调度 issue CI,worktree 并行隔离,validator 验收,写入长期记忆").to_dict() + blueprint = plan["loop_engineering"] + assert blueprint["packet_type"] == "LoopEngineeringBlueprint" + assert blueprint["activation"]["active"] is True + assert "LoopEngineeringBlueprint" in plan["tool_plan"]["tools"] + assert plan["prompt_packet_v2"]["packet_type"] == "PromptPacketV2" + + def test_aesthetic_quality_gate_detects_clutter_and_mojibake(): report = AestheticQualityGate().evaluate("premium but cluttered messy tiny elements " + chr(0x9422)) assert report.encoding_health < 100 - assert any("visual_clutter" in risk for risk in report.risks) + assert any("layout_order_missing" in risk for risk in report.risks) + assert any("text_precision_missing" in risk for risk in report.risks) assert any("encoding_risk" in risk for risk in report.risks) diff --git a/tests/test_lora_and_gitops.py b/tests/test_lora_and_gitops.py index 7daf369..b21116b 100644 --- a/tests/test_lora_and_gitops.py +++ b/tests/test_lora_and_gitops.py @@ -48,5 +48,7 @@ def test_github_release_plan_mentions_version(): assert "v9.9.9" in plan assert "draft PR" in plan -def test_github_default_release_plan_targets_v1_6_0(): - assert "v1.6.0" in GitHubManager(".").release_plan() +def test_github_default_release_plan_targets_v2_1_0(): + plan = GitHubManager(".").release_plan() + assert "v2.1.0" in plan + assert "Loop Engineering docs" in plan diff --git a/tools/validate_source_skill.py b/tools/validate_source_skill.py index a511567..9cb5adf 100644 --- a/tools/validate_source_skill.py +++ b/tools/validate_source_skill.py @@ -38,10 +38,10 @@ def main() -> int: if not re.fullmatch(r"[a-z0-9-]+", fields["name"]): print("skill name must be hyphen-case") return 1 - required = ("v2.0.0", "DesignKernel", "DesignMathEngine", "PromptPacketV2", "math_trace") + required = ("v2.1.0", "DesignKernel", "DesignMathEngine", "PromptPacketV2", "LoopEngineeringOS", "math_trace") missing = [item for item in required if item not in text] if missing: - print(f"v2.0 governance text missing: {', '.join(missing)}") + print(f"v2.1 governance text missing: {', '.join(missing)}") return 1 print("source skill is valid")