Skip to content

dse120071750/m8m-harness-builder / skills/m8m/m8m-harness-builder

m8m-harness-builder

Flagged

Build and edit M8M harnesses that coordinate existing tools and FlowSteps, validate milestone outputs, and track progress and resume. Reuse working implementations in place. Compile workflow changes without runtime packaging; build portable packages when requested and deliver server installations through the dedicated M8M server installer.

FileKindSize
.gitattributesother112 B
.gitignoreother208 B
LICENSEother673 B
README.mdmarkdown29.8 KB
SKILL.mdskill md1.3 KB
agents/audit_complete.yamlconfig1.6 KB
agents/flow_generated.yamlconfig2.2 KB
agents/harness_validated.yamlconfig2.3 KB
agents/openai.yamlconfig4.6 KB
agents/skill_shipped.yamlconfig2.1 KB
agents/toolbox_ready.yamlconfig1.6 KB
conftest.pyscript275 B
contracts/conformance/expectation_first_runtime/candidate-cases.jsonconfig4.1 KB
contracts/conformance/expectation_first_runtime/common-linear.jsonconfig2.7 KB
contracts/conformance/expectation_first_runtime/schemas/judge-decision.schema.jsonconfig373 B
contracts/conformance/expectation_first_runtime/schemas/result.output.schema.jsonconfig589 B
contracts/conformance/expectation_first_runtime/schemas/source.output.schema.jsonconfig500 B
contracts/conformance/flowstep_flow_v4/invalid/judge-loop-unbound.jsonconfig483 B
contracts/conformance/flowstep_flow_v4/invalid/malformed-execution.jsonconfig571 B
contracts/conformance/flowstep_flow_v4/invalid/no-required-output.jsonconfig455 B
contracts/conformance/flowstep_flow_v4/invalid/nonjudge-bound.jsonconfig763 B
contracts/conformance/flowstep_flow_v4/invalid/unknown-field.jsonconfig469 B
contracts/conformance/flowstep_flow_v4/valid/authoring-union.jsonconfig4.3 KB
contracts/conformance/flowstep_flow_v4/valid/platform-dag.jsonconfig1.9 KB
contracts/file_ref_v2.schema.jsonconfig484 B
contracts/flow_sequence_action_v2.schema.jsonconfig1.5 KB
contracts/flowstep_flow_v4.schema.jsonconfig13.6 KB
contracts/flowstep_output_v2.schema.jsonconfig2.8 KB
contracts/flowstep_output_v3.schema.jsonconfig3.0 KB
contracts/flowstep_skill_audit_v1.schema.jsonconfig5.1 KB
contracts/m8m_builder_configuration_v1.schema.jsonconfig252 B
contracts/m8m_builder_input_v1.schema.jsonconfig183 B
contracts/m8m_builder_installation_receipt_v2.schema.jsonconfig2.9 KB
contracts/m8m_builder_output_v1.schema.jsonconfig453 B
contracts/m8m_builder_request_v3.schema.jsonconfig707 B
contracts/m8m_builder_result_v3.schema.jsonconfig422 B
contracts/m8m_builder_source_audit_v2.schema.jsonconfig6.1 KB
contracts/m8m_builder_source_bundle_v2.schema.jsonconfig8.6 KB
contracts/m8m_builder_toolbox_manifest_v2.schema.jsonconfig2.6 KB
contracts/m8m_builder_validation_report_v2.schema.jsonconfig3.4 KB
contracts/m8m_cache_receipt_v1.schema.jsonconfig1.2 KB
contracts/m8m_candidate_cache_entry_v1.schema.jsonconfig2.8 KB
contracts/m8m_chosen_output_v1.schema.jsonconfig2.3 KB
contracts/m8m_context_capsule_v1.schema.jsonconfig1.9 KB
contracts/m8m_contract_bundle_lock_v1.schema.jsonconfig648 B
contracts/m8m_goal_ledger_v1.schema.jsonconfig1.8 KB
contracts/m8m_milestone_agent_v1.schema.jsonconfig13.8 KB
contracts/m8m_milestone_expectation_v1.schema.jsonconfig1.9 KB
contracts/m8m_milestone_judge_receipt_v1.schema.jsonconfig1.7 KB
contracts/m8m_milestone_judge_request_v1.schema.jsonconfig3.0 KB
contracts/m8m_run_context_v1.schema.jsonconfig994 B
contracts/m8m_run_context_v2.schema.jsonconfig1.2 KB
contracts/m8m_run_storage_contract_v1.schema.jsonconfig894 B
contracts/m8m_runtime_lock_v1.schema.jsonconfig1.7 KB
contracts/m8m_runtime_release_v1.schema.jsonconfig2.2 KB
contracts/m8m_skill_canvas_v1.schema.jsonconfig4.0 KB
contracts/m8m_source_asset_manifest_v1.schema.jsonconfig1.2 KB
contracts/m8m_workflow_package_archive_v1.schema.jsonconfig1.1 KB
contracts/m8m_workflow_source_bundle_proof_v1.schema.jsonconfig1.6 KB
contracts/m8m_workflow_source_bundle_v1.schema.jsonconfig19.5 KB
contracts/tool_vs_intelligence_table_v1.schema.jsonconfig1.3 KB
docs/m8m-chart.jpgbinary172.2 KB
docs/m8m-task-builder-design.zh-HK.mdmarkdown66.9 KB
examples/article_infographic/README.mdmarkdown598 B
examples/article_infographic/planning/m8m-flowchart.jpgbinary186.0 KB
examples/article_infographic/planning/m8m-flowchart.mdmarkdown4.2 KB
flows/m8m_build_v2.yamlconfig9.9 KB
flowsteps/tools/audit_complete_judge/input.schema.jsonconfig190 B
flowsteps/tools/audit_complete_judge/output.schema.jsonconfig477 B
flowsteps/tools/audit_complete_judge/tests/test_tool.pyscript1.1 KB
flowsteps/tools/audit_complete_judge/tool.pyscript1.2 KB
flowsteps/tools/audit_skill/input.schema.jsonconfig250 B
flowsteps/tools/audit_skill/output.schema.jsonconfig136 B
flowsteps/tools/audit_skill/tests/test_tool.pyscript1.9 KB
flowsteps/tools/audit_skill/tool.pyscript2.9 KB
flowsteps/tools/flow_generated_judge/input.schema.jsonconfig190 B
flowsteps/tools/flow_generated_judge/output.schema.jsonconfig475 B
flowsteps/tools/flow_generated_judge/tests/test_tool.pyscript1.1 KB
flowsteps/tools/flow_generated_judge/tool.pyscript1.5 KB
flowsteps/tools/generate_from_audit/input.schema.jsonconfig562 B
flowsteps/tools/generate_from_audit/output.schema.jsonconfig137 B
flowsteps/tools/generate_from_audit/tests/test_tool.pyscript2.2 KB
flowsteps/tools/generate_from_audit/tool.pyscript3.0 KB
flowsteps/tools/harness_validated_judge/input.schema.jsonconfig193 B
flowsteps/tools/harness_validated_judge/output.schema.jsonconfig488 B
flowsteps/tools/harness_validated_judge/tests/test_tool.pyscript1.1 KB
flowsteps/tools/harness_validated_judge/tool.pyscript1.3 KB
flowsteps/tools/install_local_skill/input.schema.jsonconfig733 B
flowsteps/tools/install_local_skill/output.schema.jsonconfig144 B
flowsteps/tools/install_local_skill/tests/test_tool.pyscript2.1 KB
flowsteps/tools/install_local_skill/tool.pyscript3.0 KB
flowsteps/tools/install_toolbox/input.schema.jsonconfig400 B
flowsteps/tools/install_toolbox/output.schema.jsonconfig140 B
flowsteps/tools/install_toolbox/tests/test_tool.pyscript1.9 KB
flowsteps/tools/install_toolbox/tool.pyscript3.0 KB
flowsteps/tools/skill_shipped_judge/input.schema.jsonconfig189 B
flowsteps/tools/skill_shipped_judge/output.schema.jsonconfig484 B
flowsteps/tools/skill_shipped_judge/tests/test_tool.pyscript1.1 KB
flowsteps/tools/skill_shipped_judge/tool.pyscript1.3 KB
flowsteps/tools/toolbox_ready_judge/input.schema.jsonconfig189 B
flowsteps/tools/toolbox_ready_judge/output.schema.jsonconfig490 B
flowsteps/tools/toolbox_ready_judge/tests/test_tool.pyscript1.3 KB
flowsteps/tools/toolbox_ready_judge/tool.pyscript1.6 KB
flowsteps/tools/validate_harness/input.schema.jsonconfig563 B
flowsteps/tools/validate_harness/output.schema.jsonconfig141 B
flowsteps/tools/validate_harness/tests/test_tool.pyscript2.1 KB
flowsteps/tools/validate_harness/tool.pyscript3.0 KB
planning/upgrade.mdmarkdown16.2 KB
references/architecture.mdmarkdown28.1 KB
references/audit_complete.mdmarkdown739 B
references/builder-authoring.mdmarkdown9.8 KB
references/flow_generated.mdmarkdown1.2 KB
references/flowstep-development.mdmarkdown4.3 KB
references/harness-invocation.mdmarkdown2.9 KB
references/harness_validated.mdmarkdown786 B
references/master-prompts.mdmarkdown14.0 KB
references/milestone.mdmarkdown11.4 KB
references/output-lineage.mdmarkdown4.4 KB
references/runtime-packaging.mdmarkdown35.2 KB
references/server-delivery.mdmarkdown6.8 KB
references/skill_shipped.mdmarkdown798 B
references/tool-vs-intelligence.mdmarkdown10.0 KB
references/toolbox_ready.mdmarkdown612 B
requirements.txtmanifest150 B
scripts/audit_harness.pyscript80.7 KB
scripts/candidate_cache.pyscript27.6 KB
scripts/coordinate_workflow.pyscript4.3 KB
scripts/execution_identity.pyscript1.0 KB
scripts/flowchart_jpg.pyscript16.1 KB
scripts/flowstep_instruction.pyscript14.1 KB
scripts/flowstep_runtime.pyscript108.6 KB
scripts/flowstep_tools.pyscript5.7 KB
scripts/gem_text.pyscript5.7 KB
scripts/generate_harness.pyscript61.4 KB
scripts/humanize_chart.pyscript5.6 KB
scripts/humanize_chart_zh.pyscript5.2 KB
scripts/import_flow_v4.pyscript62.3 KB
scripts/m8m_build_steps.pyscript143.2 KB
scripts/m8m_cache.pyscript1.7 KB
scripts/m8m_delivery_common.pyscript3.8 KB
scripts/m8m_deploy.pyscript5.6 KB
scripts/m8m_factory.pyscript10.1 KB
scripts/m8m_flowchart.pyscript16.6 KB
scripts/m8m_local_bundle.pyscript4.5 KB
scripts/migrate_skill_source.pyscript34.2 KB
scripts/milestone_expectation.pyscript3.3 KB
scripts/milestone_pair.pyscript3.1 KB
scripts/package_archive.pyscript7.1 KB
scripts/project_imports.pyscript10.8 KB
scripts/run_flow.pyscript153.8 KB
scripts/run_goal.pyscript14.1 KB
scripts/run_m8m.pyscript3.8 KB
scripts/runtime_release.pyscript45.0 KB
scripts/schema_gate.pyscript5.6 KB
scripts/session_layout.pyscript74.4 KB
scripts/skill_source.pyscript65.3 KB
scripts/source_bundle.pyscript87.7 KB
scripts/teaching_contracts.pyscript8.9 KB
scripts/tool_vs_intelligence.pyscript9.3 KB
scripts/toolbox_plan.pyscript6.1 KB
scripts/validate_harness.pyscript24.1 KB
scripts/verify_platform_contract_parity.pyscript2.9 KB
seeds/branch_receipt/input.schema.jsonconfig1.0 KB
seeds/branch_receipt/output.schema.jsonconfig359 B
seeds/branch_receipt/tests/test_tool.pyscript2.0 KB
seeds/branch_receipt/tool.pyscript3.7 KB
seeds/cycle_receipt/input.schema.jsonconfig1.0 KB
seeds/cycle_receipt/output.schema.jsonconfig319 B
seeds/cycle_receipt/tests/test_tool.pyscript1.5 KB
seeds/cycle_receipt/tool.pyscript2.0 KB
seeds/hash_bind/input.schema.jsonconfig213 B
seeds/hash_bind/output.schema.jsonconfig288 B
seeds/hash_bind/tests/test_tool.pyscript814 B
seeds/hash_bind/tool.pyscript527 B
seeds/ledger_receipt/input.schema.jsonconfig278 B
seeds/ledger_receipt/output.schema.jsonconfig355 B
seeds/ledger_receipt/tests/test_tool.pyscript842 B
seeds/ledger_receipt/tool.pyscript747 B
seeds/ok_receipt/input.schema.jsonconfig280 B
seeds/ok_receipt/output.schema.jsonconfig280 B
seeds/ok_receipt/tests/test_tool.pyscript667 B
seeds/ok_receipt/tool.pyscript682 B
seeds/schema_validate/input.schema.jsonconfig265 B
seeds/schema_validate/output.schema.jsonconfig196 B
seeds/schema_validate/tests/test_tool.pyscript1.0 KB
seeds/schema_validate/tool.pyscript844 B
seeds/slot_write/input.schema.jsonconfig558 B
seeds/slot_write/output.schema.jsonconfig346 B
seeds/slot_write/tests/test_tool.pyscript1.2 KB
seeds/slot_write/tool.pyscript1015 B
tests/__init__.pyscript0 B
tests/support.pyscript668 B
tests/test_audit_harness.pyscript23.5 KB
tests/test_branch.pyscript14.4 KB
tests/test_builder3_templates.pyscript2.4 KB
tests/test_builder_install_integrity.pyscript30.6 KB
tests/test_builder_native_snapshot.pyscript5.0 KB
tests/test_builder_requirements.pyscript26.8 KB
tests/test_builder_self_dogfood.pyscript7.0 KB
tests/test_builder_self_source.pyscript10.3 KB

scripts/project_imports.py

View on GitHub
"""Scoped imports from an explicit frozen codebase module allowlist.

This module never adds a directory to sys.path. The runtime supplies the exact
codebase, ordered author declarations and already verified implementation files.
"""
from __future__ import annotations

from contextlib import contextmanager
import hashlib
import importlib.machinery
import importlib.util
from pathlib import Path, PurePosixPath
import sys
import sysconfig
import threading


class ProjectImportError(ValueError):
    pass


def validate_roots(values):
    if not isinstance(values, list) or not 1 <= len(values) <= 16:
        raise ProjectImportError('codebase_import_roots must contain one to sixteen ordered roots')
    if any(not isinstance(value, str) for value in values) or len(set(values)) != len(values):
        raise ProjectImportError('codebase_import_roots must contain distinct strings')
    for value in values:
        path = PurePosixPath(value)
        if (not value or '\\' in value or ':' in value or path.is_absolute()
                or '..' in path.parts or (value != '.' and ('.' in value.split('/') or str(path) != value))):
            raise ProjectImportError(f'unsafe codebase import root: {value!r}')
    return tuple(values)


def _safe_path(project, path):
    if not path.is_relative_to(project):
        raise ProjectImportError(f'import path escapes captured codebase: {path}')
    cursor = project
    for part in path.relative_to(project).parts:
        cursor = cursor / part
        if cursor.is_symlink() or bool(getattr(cursor, 'is_junction', lambda: False)()):
            raise ProjectImportError(f'import path uses an unsafe link: {cursor}')
    if path.resolve() != path:
        raise ProjectImportError(f'import path differs from captured physical path: {path}')


def module_map(project, values, files):
    """Return exact names/namespace parents; do not enumerate import directories."""
    project = Path(project).absolute()
    if project.is_symlink() or bool(getattr(project, 'is_junction', lambda: False)()):
        raise ProjectImportError('captured codebase cannot be an unsafe link')
    modules, roots = {}, validate_roots(values)
    frozen = {Path(path).absolute() for path in files if Path(path).suffix == '.py'}
    for relative in roots:
        root = project if relative == '.' else project.joinpath(*PurePosixPath(relative).parts)
        _safe_path(project, root)
        if not root.is_dir():
            raise ProjectImportError(f'declared import root is missing: {relative}')
        covered = False
        for path in sorted(frozen):
            if not path.is_relative_to(root):
                continue
            pieces = list(path.relative_to(root).with_suffix('').parts)
            package = pieces[-1:] == ['__init__']
            if package:
                pieces.pop()
            if not pieces or not all(part.isidentifier() for part in pieces):
                continue
            _safe_path(project, path)
            if not path.is_file():
                raise ProjectImportError(f'captured import file is missing: {path}')
            covered = True
            for count in range(1, len(pieces) + 1):
                name = '.'.join(pieces[:count])
                exact = count == len(pieces)
                location = path if exact else root.joinpath(*pieces[:count])
                record = (location, package if exact else True, exact)
                previous = modules.get(name)
                if previous is not None:
                    if previous[0] != location:
                        # A captured package initializer and its namespace
                        # parent designate the same physical package directory.
                        old_dir = previous[0].parent if previous[2] and previous[1] else previous[0]
                        new_dir = location.parent if exact and package else location
                        if old_dir != new_dir or (previous[2] and exact):
                            raise ProjectImportError(f'ambiguous captured module: {name}')
                    if previous[2]:
                        continue
                modules[name] = record
        if not covered:
            raise ProjectImportError(f'import root has no captured Python modules: {relative}')
    return project, roots, modules


def _hash(path):
    return hashlib.sha256(path.read_bytes()).hexdigest()


class _BytesLoader:
    def __init__(self, path, digest):
        self.path, self.digest = path, digest

    def create_module(self, spec):
        return None

    def exec_module(self, module):
        content = self.path.read_bytes()
        if hashlib.sha256(content).hexdigest() != self.digest:
            raise ProjectImportError(f'captured module bytes changed: {self.path}')
        exec(compile(content, str(self.path), 'exec'), module.__dict__)


class _Finder:
    def __init__(self, modules, digests):
        self.modules, self.digests = modules, digests
        self.tops = {name.split('.')[0] for name in modules}

    def find_spec(self, fullname, path=None, target=None):
        if fullname.split('.')[0] not in self.tops:
            return None
        record = self.modules.get(fullname)
        if record is None:
            raise ModuleNotFoundError(f'project module is not captured: {fullname}', name=fullname)
        location, package, exact = record
        if not exact:
            spec = importlib.machinery.ModuleSpec(fullname, None, is_package=True)
            spec.submodule_search_locations = [str(location)]
            return spec
        return importlib.util.spec_from_file_location(fullname,
            location, loader=_BytesLoader(location, self.digests[location]),
            submodule_search_locations=[str(location.parent)] if package else None)


_LOCK = threading.RLock()
_ACTIVE = None
_CACHES = {}


class ImportContext:
    def __init__(self, project, roots, modules, implementation_fingerprint, all_digests):
        self.project, self.roots, self.modules = project, roots, modules
        self.digests = {row[0]: _hash(row[0]) for row in modules.values() if row[2]}
        self.all_digests = all_digests
        self.key = (str(project), roots, implementation_fingerprint)
        self.finder = _Finder(modules, self.digests)
        self.tops = self.finder.tops
        self.cache = _CACHES.setdefault(self.key, {})

    def _owned(self, name):
        return name.split('.')[0] in self.tops

    def _check_module(self, name, module):
        record = self.modules.get(name)
        if module is None or record is None:
            raise ProjectImportError(f'foreign cached project module: {name}')
        location, package, exact = record
        origin = getattr(module, '__file__', None)
        if exact and (not origin or Path(origin).absolute() != location):
            raise ProjectImportError(f'foreign cached project module: {name}')
        if not exact and origin:
            raise ProjectImportError(f'foreign cached namespace module: {name}')
        if package:
            expected = location.parent if exact else location
            actual = tuple(Path(value).absolute() for value in getattr(module, '__path__', ()))
            if actual != (expected,):
                raise ProjectImportError(f'foreign cached project package path: {name}')

    def _check_priority(self):
        stdlib = set(getattr(sys, 'stdlib_module_names', ())) | set(sys.builtin_module_names)
        trusted = {Path(sysconfig.get_path('stdlib')).absolute(), Path(sys.base_prefix).absolute()}
        # Runtime vendor roots are already verified by the immutable launcher;
        # installed site-packages serve the same role during Builder validation.
        trusted.update(Path(value).absolute() for value in sys.path if value and ('site-packages' in Path(value).parts or 'vendor' in Path(value).parts))
        for name in self.tops:
            if name in stdlib:
                raise ProjectImportError(f'project module would shadow stdlib: {name}')
            spec = importlib.machinery.PathFinder.find_spec(name)
            if spec:
                locations = list(spec.submodule_search_locations or ())
                if spec.origin and spec.origin not in {'built-in', 'frozen'}:
                    locations.append(spec.origin)
                for location in locations:
                    origin = Path(location).absolute()
                    if any(origin.is_relative_to(root) for root in trusted):
                        raise ProjectImportError(f'project module would shadow a trusted dependency: {name}')

    @contextmanager
    def activate(self):
        global _ACTIVE
        with _LOCK:
            if _ACTIVE is not None:
                if _ACTIVE.key != self.key:
                    raise ProjectImportError('cannot nest different captured codebase import contexts')
                yield
                return
            self._check_priority()
            for path, digest in self.all_digests.items():
                _safe_path(self.project, path)
                if _hash(path) != digest:
                    raise ProjectImportError(f'captured implementation bytes changed: {path}')
            for name, module in list(sys.modules.items()):
                if self._owned(name):
                    self._check_module(name, module)
                    # Origin alone is insufficient: an unrelated loader may
                    # have executed different bytes under a forged filename.
                    if self.cache.get(name) is not module:
                        raise ProjectImportError(f'foreign cached project module: {name}')
            for name, module in self.cache.items():
                self._check_module(name, module)
            sys.modules.update(self.cache)
            position = next((i for i, finder in enumerate(sys.meta_path) if finder is importlib.machinery.PathFinder), len(sys.meta_path))
            sys.meta_path.insert(position, self.finder)
            _ACTIVE = self
            try:
                yield
            finally:
                selected = {name: module for name, module in list(sys.modules.items()) if self._owned(name)}
                for name in selected:
                    sys.modules.pop(name, None)
                if self.finder in sys.meta_path:
                    sys.meta_path.remove(self.finder)
                _ACTIVE = None
                for name, module in selected.items():
                    self._check_module(name, module)
                self.cache.update(selected)


def import_context(project, roots, files):
    files = tuple(sorted({Path(path).absolute() for path in files}))
    fingerprint = hashlib.sha256()
    all_digests = {}
    for path in files:
        content = path.read_bytes()
        all_digests[path] = hashlib.sha256(content).hexdigest()
        fingerprint.update(str(path).encode('utf-8') + b'\0' + content + b'\0')
    return ImportContext(*module_map(project, roots, files), fingerprint.hexdigest(), all_digests)
planning-and-task-breakdownaddyosmani/agent-skillsBreaks work into ordered tasks. Use when you have a spec or clear requirements and need to break work into implementable tasks. Use when a task feels too large to start, when you need to estimate scope, or when parallel work is possible.Stars: 119kUpdated Claude CodeCodexVerifiedInstall
screenpipethedotmack/claude-memSearch screen and audio history recorded by Screenpipe and optionally save selected context into claude-mem. Use when the user asks to recall desktop activity, a meeting, or something seen in another app through Screenpipe.Stars: 118kUpdated Claude CodeCodexVerifiedInstall
contact-widgetnexu-io/open-designSelf-contained floating chat widget with welcome screen, social links, meeting button, and message input. Single HTML file, zero dependencies.Stars: 108kUpdated Claude CodeCodexVerifiedInstall
meeting-notesnexu-io/open-designMeeting notes page — title bar with attendees, agenda checklist, decisions block, action items table with owners + dates, and a "next meeting" footer. Use when the brief mentions "meeting notes", "minutes", "1:1 notes", "all-hands recap", or "会议纪要".Stars: 108kUpdated Claude CodeCodexVerifiedInstall