Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
89 changes: 51 additions & 38 deletions README.md
Original file line number Diff line number Diff line change
@@ -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

Expand All @@ -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.
2 changes: 1 addition & 1 deletion app/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "2.0.0"
__version__ = "2.1.0"
6 changes: 4 additions & 2 deletions app/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,15 @@ 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")
envart_cad_parser = sub.add_parser("envart-cad")
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")
Expand Down Expand Up @@ -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:
Expand Down
16 changes: 15 additions & 1 deletion app/core/capabilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -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():
Expand All @@ -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)
19 changes: 17 additions & 2 deletions app/core/design_kernel.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")


Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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:
Expand All @@ -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":
Expand Down Expand Up @@ -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)
Expand All @@ -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),
Expand All @@ -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):
Expand Down
Loading
Loading