add skills
This commit is contained in:
@@ -19,7 +19,7 @@ class BuildTestExecutorAgentConfigTests(unittest.TestCase):
|
||||
self.assertEqual(data["name"], "build-test-executor-agent")
|
||||
self.assertIn("C++/MSVC/CMake/CTest validation", data["description"])
|
||||
self.assertEqual(data["sandbox_mode"], "workspace-write")
|
||||
self.assertEqual(data["model_reasoning_effort"], "high")
|
||||
self.assertEqual(data["model_reasoning_effort"], "extra high")
|
||||
self.assertIn("developer_instructions", data)
|
||||
|
||||
def test_build_test_executor_agent_instructions_enforce_boundaries(self):
|
||||
|
||||
@@ -19,7 +19,7 @@ class CoordinatorAgentConfigTests(unittest.TestCase):
|
||||
self.assertEqual(data["name"], "coordinator-agent")
|
||||
self.assertIn("workflow state", data["description"])
|
||||
self.assertEqual(data["sandbox_mode"], "workspace-write")
|
||||
self.assertEqual(data["model_reasoning_effort"], "high")
|
||||
self.assertEqual(data["model_reasoning_effort"], "extra high")
|
||||
self.assertIn("developer_instructions", data)
|
||||
|
||||
def test_coordinator_agent_instructions_enforce_boundaries(self):
|
||||
|
||||
@@ -19,7 +19,7 @@ class CorrectionAgentConfigTests(unittest.TestCase):
|
||||
self.assertEqual(data["name"], "correction-agent")
|
||||
self.assertIn("C++/MSVC/CMake/CTest fixes", data["description"])
|
||||
self.assertEqual(data["sandbox_mode"], "workspace-write")
|
||||
self.assertEqual(data["model_reasoning_effort"], "high")
|
||||
self.assertEqual(data["model_reasoning_effort"], "extra high")
|
||||
self.assertIn("developer_instructions", data)
|
||||
|
||||
def test_correction_agent_instructions_enforce_boundaries(self):
|
||||
|
||||
@@ -0,0 +1,92 @@
|
||||
import unittest
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[1]
|
||||
SKILL_PATH = ROOT / ".codex" / "skills" / "fesa-feature-definition" / "SKILL.md"
|
||||
|
||||
|
||||
def read_skill():
|
||||
return SKILL_PATH.read_text(encoding="utf-8")
|
||||
|
||||
|
||||
def parse_frontmatter(text):
|
||||
lines = text.splitlines()
|
||||
if not lines or lines[0] != "---":
|
||||
raise AssertionError("SKILL.md must start with YAML frontmatter")
|
||||
|
||||
fields = {}
|
||||
for line in lines[1:]:
|
||||
if line == "---":
|
||||
return fields
|
||||
key, sep, value = line.partition(":")
|
||||
if not sep:
|
||||
raise AssertionError(f"Invalid frontmatter line: {line}")
|
||||
fields[key.strip()] = value.strip()
|
||||
|
||||
raise AssertionError("SKILL.md frontmatter must be closed")
|
||||
|
||||
|
||||
class FesaFeatureDefinitionSkillTests(unittest.TestCase):
|
||||
def test_skill_file_exists_with_required_frontmatter(self):
|
||||
self.assertTrue(SKILL_PATH.exists(), "fesa-feature-definition SKILL.md is missing")
|
||||
|
||||
fields = parse_frontmatter(read_skill())
|
||||
|
||||
self.assertEqual(set(fields), {"name", "description"})
|
||||
self.assertEqual(fields["name"], "fesa-feature-definition")
|
||||
self.assertIn("Use when", fields["description"])
|
||||
self.assertIn("FESA solver feature requests", fields["description"])
|
||||
self.assertIn("requirements", fields["description"])
|
||||
self.assertIn("research questions", fields["description"])
|
||||
self.assertIn("acceptance criteria", fields["description"])
|
||||
self.assertIn("verification matrices", fields["description"])
|
||||
|
||||
def test_skill_body_defines_core_workflow_and_inputs(self):
|
||||
body = read_skill()
|
||||
|
||||
for required_text in (
|
||||
"## Inputs",
|
||||
"## Workflow",
|
||||
"## Output Contract",
|
||||
"## Boundaries",
|
||||
"## Quality Gate",
|
||||
"docs/SOLVER_SKILL_DESIGN.md",
|
||||
"docs/SOLVER_AGENT_DESIGN.md",
|
||||
"AGENTS.md",
|
||||
"docs/requirements/<feature-id>.md",
|
||||
"docs/research/<feature-id>-research.md",
|
||||
):
|
||||
self.assertIn(required_text, body)
|
||||
|
||||
def test_skill_body_defines_requirement_and_verification_contract(self):
|
||||
body = read_skill()
|
||||
|
||||
for required_text in (
|
||||
"Feature Definition Packet",
|
||||
"shall",
|
||||
"Requirement Verification Matrix",
|
||||
"Research Questions",
|
||||
"Reference Artifact Needs",
|
||||
"Tolerance Decisions",
|
||||
"Downstream Handoff",
|
||||
"FESA-REQ-<FEATURE>-###",
|
||||
"needs-user-decision",
|
||||
):
|
||||
self.assertIn(required_text, body)
|
||||
|
||||
def test_skill_body_enforces_scope_boundaries(self):
|
||||
body = read_skill()
|
||||
|
||||
for required_text in (
|
||||
"Do not finalize FEM formulations.",
|
||||
"Do not implement C++ code.",
|
||||
"Do not run Abaqus, Nastran, or any reference solver.",
|
||||
"Do not generate reference CSVs.",
|
||||
"Do not approve release readiness.",
|
||||
):
|
||||
self.assertIn(required_text, body)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
@@ -0,0 +1,124 @@
|
||||
import unittest
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[1]
|
||||
SKILL_PATH = ROOT / ".codex" / "skills" / "fesa-fem-specification" / "SKILL.md"
|
||||
|
||||
|
||||
def read_skill():
|
||||
return SKILL_PATH.read_text(encoding="utf-8")
|
||||
|
||||
|
||||
def parse_frontmatter(text):
|
||||
lines = text.splitlines()
|
||||
if not lines or lines[0] != "---":
|
||||
raise AssertionError("SKILL.md must start with YAML frontmatter")
|
||||
|
||||
fields = {}
|
||||
for line in lines[1:]:
|
||||
if line == "---":
|
||||
return fields
|
||||
key, sep, value = line.partition(":")
|
||||
if not sep:
|
||||
raise AssertionError(f"Invalid frontmatter line: {line}")
|
||||
fields[key.strip()] = value.strip()
|
||||
|
||||
raise AssertionError("SKILL.md frontmatter must be closed")
|
||||
|
||||
|
||||
class FesaFemSpecificationSkillTests(unittest.TestCase):
|
||||
def test_skill_file_exists_with_required_frontmatter(self):
|
||||
self.assertTrue(SKILL_PATH.exists(), "fesa-fem-specification SKILL.md is missing")
|
||||
|
||||
fields = parse_frontmatter(read_skill())
|
||||
|
||||
self.assertEqual(set(fields), {"name", "description"})
|
||||
self.assertEqual(fields["name"], "fesa-fem-specification")
|
||||
self.assertIn("Use when", fields["description"])
|
||||
self.assertIn("FESA FEM formulations", fields["description"])
|
||||
self.assertIn("numerical review", fields["description"])
|
||||
self.assertIn("Abaqus .inp", fields["description"])
|
||||
self.assertIn("CSV schemas", fields["description"])
|
||||
self.assertIn("implementation-planning handoffs", fields["description"])
|
||||
|
||||
def test_skill_body_defines_workflow_and_inputs(self):
|
||||
body = read_skill()
|
||||
|
||||
for required_text in (
|
||||
"## Inputs",
|
||||
"## Workflow",
|
||||
"INPUT CHECK",
|
||||
"FORMULATION SPEC",
|
||||
"NUMERICAL REVIEW CHECK",
|
||||
"I/O CONTRACT",
|
||||
"HANDOFF",
|
||||
"## Quality Gate",
|
||||
"docs/SOLVER_SKILL_DESIGN.md",
|
||||
"docs/SOLVER_AGENT_DESIGN.md",
|
||||
"AGENTS.md",
|
||||
"docs/requirements/<feature-id>.md",
|
||||
"docs/research/<feature-id>-research.md",
|
||||
):
|
||||
self.assertIn(required_text, body)
|
||||
|
||||
def test_skill_body_defines_formulation_contract(self):
|
||||
body = read_skill()
|
||||
|
||||
for required_text in (
|
||||
"Strong Form",
|
||||
"Weak or Variational Form",
|
||||
"Discretization",
|
||||
"Kinematics",
|
||||
"Element Equations",
|
||||
"Mapping and Numerical Integration",
|
||||
"Output Recovery",
|
||||
"Numerical Risks",
|
||||
"partition of unity",
|
||||
"Kronecker delta",
|
||||
"Jacobian",
|
||||
"derivative transform",
|
||||
):
|
||||
self.assertIn(required_text, body)
|
||||
|
||||
def test_skill_body_defines_io_contract(self):
|
||||
body = read_skill()
|
||||
|
||||
for required_text in (
|
||||
"Abaqus Input Scope",
|
||||
"Model Data Mapping",
|
||||
"History Data Mapping",
|
||||
"Internal Model Contract",
|
||||
"Output and CSV Schemas",
|
||||
"*NODE",
|
||||
"*ELEMENT",
|
||||
"*MATERIAL",
|
||||
"*ELASTIC",
|
||||
"*BOUNDARY",
|
||||
"*STEP",
|
||||
"*OUTPUT",
|
||||
"*NODE OUTPUT",
|
||||
"*ELEMENT OUTPUT",
|
||||
"displacements.csv",
|
||||
"reactions.csv",
|
||||
"element_forces.csv",
|
||||
"stresses.csv",
|
||||
):
|
||||
self.assertIn(required_text, body)
|
||||
|
||||
def test_skill_body_enforces_scope_boundaries(self):
|
||||
body = read_skill()
|
||||
|
||||
for required_text in (
|
||||
"Do not implement C++ code.",
|
||||
"Do not design C++ APIs.",
|
||||
"Do not implement parsers.",
|
||||
"Do not run Abaqus, Nastran, or any reference solver.",
|
||||
"Do not generate reference CSVs.",
|
||||
"Do not approve release readiness.",
|
||||
):
|
||||
self.assertIn(required_text, body)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
@@ -19,7 +19,7 @@ class FormulationAgentConfigTests(unittest.TestCase):
|
||||
self.assertEqual(data["name"], "formulation-agent")
|
||||
self.assertIn("FEM formulation", data["description"])
|
||||
self.assertEqual(data["sandbox_mode"], "read-only")
|
||||
self.assertEqual(data["model_reasoning_effort"], "high")
|
||||
self.assertEqual(data["model_reasoning_effort"], "extra high")
|
||||
self.assertIn("developer_instructions", data)
|
||||
|
||||
def test_formulation_agent_instructions_enforce_boundaries(self):
|
||||
|
||||
@@ -18,7 +18,7 @@ class ImplementationAgentConfigTests(unittest.TestCase):
|
||||
self.assertEqual(data["name"], "implementation-agent")
|
||||
self.assertIn("C++17/MSVC", data["description"])
|
||||
self.assertEqual(data["sandbox_mode"], "workspace-write")
|
||||
self.assertEqual(data["model_reasoning_effort"], "high")
|
||||
self.assertEqual(data["model_reasoning_effort"], "extra high")
|
||||
self.assertIn("developer_instructions", data)
|
||||
|
||||
def test_implementation_agent_instructions_define_tdd_execution_contract(self):
|
||||
|
||||
@@ -19,7 +19,7 @@ class ImplementationPlanningAgentConfigTests(unittest.TestCase):
|
||||
self.assertEqual(data["name"], "implementation-planning-agent")
|
||||
self.assertIn("TDD-first C++/MSVC implementation plans", data["description"])
|
||||
self.assertEqual(data["sandbox_mode"], "read-only")
|
||||
self.assertEqual(data["model_reasoning_effort"], "high")
|
||||
self.assertEqual(data["model_reasoning_effort"], "extra high")
|
||||
self.assertIn("developer_instructions", data)
|
||||
|
||||
def test_implementation_planning_agent_instructions_enforce_boundaries(self):
|
||||
|
||||
@@ -19,7 +19,7 @@ class IoDefinitionAgentConfigTests(unittest.TestCase):
|
||||
self.assertEqual(data["name"], "io-definition-agent")
|
||||
self.assertIn("Abaqus input-file subsets", data["description"])
|
||||
self.assertEqual(data["sandbox_mode"], "read-only")
|
||||
self.assertEqual(data["model_reasoning_effort"], "high")
|
||||
self.assertEqual(data["model_reasoning_effort"], "extra high")
|
||||
self.assertIn("developer_instructions", data)
|
||||
|
||||
def test_io_definition_agent_instructions_enforce_boundaries(self):
|
||||
|
||||
@@ -19,7 +19,7 @@ class NumericalReviewAgentConfigTests(unittest.TestCase):
|
||||
self.assertEqual(data["name"], "numerical-review-agent")
|
||||
self.assertIn("numerical correctness", data["description"])
|
||||
self.assertEqual(data["sandbox_mode"], "read-only")
|
||||
self.assertEqual(data["model_reasoning_effort"], "high")
|
||||
self.assertEqual(data["model_reasoning_effort"], "extra high")
|
||||
self.assertIn("developer_instructions", data)
|
||||
|
||||
def test_numerical_review_agent_instructions_enforce_boundaries(self):
|
||||
|
||||
@@ -19,7 +19,7 @@ class PhysicsEvaluationAgentConfigTests(unittest.TestCase):
|
||||
self.assertEqual(data["name"], "physics-evaluation-agent")
|
||||
self.assertIn("physical plausibility", data["description"])
|
||||
self.assertEqual(data["sandbox_mode"], "workspace-write")
|
||||
self.assertEqual(data["model_reasoning_effort"], "high")
|
||||
self.assertEqual(data["model_reasoning_effort"], "extra high")
|
||||
self.assertIn("developer_instructions", data)
|
||||
|
||||
def test_physics_evaluation_agent_instructions_enforce_boundaries(self):
|
||||
|
||||
@@ -19,7 +19,7 @@ class ReferenceModelAgentConfigTests(unittest.TestCase):
|
||||
self.assertEqual(data["name"], "reference-model-agent")
|
||||
self.assertIn("reference model packages", data["description"])
|
||||
self.assertEqual(data["sandbox_mode"], "read-only")
|
||||
self.assertEqual(data["model_reasoning_effort"], "high")
|
||||
self.assertEqual(data["model_reasoning_effort"], "extra high")
|
||||
self.assertIn("developer_instructions", data)
|
||||
|
||||
def test_reference_model_agent_instructions_enforce_boundaries(self):
|
||||
|
||||
@@ -19,7 +19,7 @@ class ReferenceVerificationAgentConfigTests(unittest.TestCase):
|
||||
self.assertEqual(data["name"], "reference-verification-agent")
|
||||
self.assertIn("stored Abaqus reference CSV artifacts", data["description"])
|
||||
self.assertEqual(data["sandbox_mode"], "workspace-write")
|
||||
self.assertEqual(data["model_reasoning_effort"], "high")
|
||||
self.assertEqual(data["model_reasoning_effort"], "extra high")
|
||||
self.assertIn("developer_instructions", data)
|
||||
|
||||
def test_reference_verification_agent_instructions_enforce_boundaries(self):
|
||||
|
||||
@@ -19,7 +19,7 @@ class ReleaseAgentConfigTests(unittest.TestCase):
|
||||
self.assertEqual(data["name"], "release-agent")
|
||||
self.assertIn("release readiness", data["description"])
|
||||
self.assertEqual(data["sandbox_mode"], "workspace-write")
|
||||
self.assertEqual(data["model_reasoning_effort"], "high")
|
||||
self.assertEqual(data["model_reasoning_effort"], "extra high")
|
||||
self.assertIn("developer_instructions", data)
|
||||
|
||||
def test_release_agent_instructions_enforce_boundaries(self):
|
||||
|
||||
@@ -19,7 +19,7 @@ class RequirementAgentConfigTests(unittest.TestCase):
|
||||
self.assertEqual(data["name"], "requirement-agent")
|
||||
self.assertIn("verifiable requirements", data["description"])
|
||||
self.assertEqual(data["sandbox_mode"], "read-only")
|
||||
self.assertEqual(data["model_reasoning_effort"], "high")
|
||||
self.assertEqual(data["model_reasoning_effort"], "extra high")
|
||||
self.assertIn("developer_instructions", data)
|
||||
|
||||
def test_requirement_agent_instructions_enforce_boundaries(self):
|
||||
|
||||
@@ -19,7 +19,7 @@ class ResearchAgentConfigTests(unittest.TestCase):
|
||||
self.assertEqual(data["name"], "research-agent")
|
||||
self.assertIn("FEM theory", data["description"])
|
||||
self.assertEqual(data["sandbox_mode"], "read-only")
|
||||
self.assertEqual(data["model_reasoning_effort"], "high")
|
||||
self.assertEqual(data["model_reasoning_effort"], "extra high")
|
||||
self.assertIn("developer_instructions", data)
|
||||
|
||||
def test_research_agent_instructions_enforce_boundaries(self):
|
||||
|
||||
Reference in New Issue
Block a user