Skip to content

Method lane: project frontmatter composition hints / Method lane:投影 method frontmatter 组合提示 #121

Description

@zhnt

Summary / 摘要

EN: Add a narrow method-lane feature so method frontmatter can declare and project allowed_skills, suggested_tools, expected_artifacts, and approval_gates.

中文:补一个窄的 method lane 功能,让 method frontmatter 支持并投影 allowed_skillssuggested_toolsexpected_artifactsapproval_gates

Why / 背景

EN: MethodProjection already has these fields, but current method compilation/projection does not populate them from method frontmatter. This leaves method assets unable to explicitly compose with skills/tools/artifact expectations even though the projection contract has room for it.

中文:MethodProjection 已经有这些字段,但当前 method 编译/投影链路还没有从 method frontmatter 填充它们。结果是 method asset 还不能显式组合 skill/tool/artifact expectation,尽管 projection contract 已经预留了字段。

Scope / 范围

Implement frontmatter support for:

  • allowed_skills
  • suggested_tools
  • expected_artifacts
  • approval_gates

Expected data flow:

method frontmatter
  -> MethodCompiler / MethodStep.projection
  -> MethodProjector
  -> MethodProjection.allowed_skills / suggested_tools / expected_artifacts / approval_gates

Suggested frontmatter semantics:

  • Accept either snake_case keys above or documented aliases only if an alias convention already exists locally.
  • Accept string or list/tuple of non-empty strings.
  • Normalize to tuple[str, ...].
  • Ignore invalid non-string values rather than leaking them into projections.
  • Preserve existing defaults as empty tuples.

Non-Goals / 非目标

  • Do not execute skills.
  • Do not resolve skill package availability.
  • Do not change agent loop behavior.
  • Do not enable Native TUI --method.
  • Do not enable RPC --method.
  • Do not add method scheduling or multi-agent lane semantics.
  • Do not make pi compatibility changes.

Suggested Files / 建议文件

  • src/loushang/method/compiler.py
  • src/loushang/method/projection.py
  • tests/method/test_method_compiler.py
  • tests/method/test_method_projection.py
  • docs/internals/architecture/coding/component-interfaces/method.md
  • If PR Define method facts contract / 定义 method facts 契约 #120 has landed before this is implemented, also update docs/internals/architecture/coding/method-facts-contract.md only if needed for clarity. These four projection fields are MethodProjection fields, not plan_facts / step_facts.

Acceptance Criteria / 验收标准

  • A method descriptor with frontmatter declaring all four fields compiles to a step whose projection retains normalized tuple values.
  • MethodProjector.project(...) copies those values into the corresponding MethodProjection fields.
  • Invalid values are ignored or filtered without raising for otherwise valid methods.
  • Existing method projection behavior remains unchanged when fields are absent.
  • Tests prove the projection fields are populated and defaults remain empty tuples.
  • Documentation explains that these are projection hints for downstream composition, not execution guarantees.

Verification / 验证

Run from the method lane:

uv --cache-dir .uv-cache run --extra dev pytest tests/method/test_method_compiler.py tests/method/test_method_projection.py -q
uv --cache-dir .uv-cache run --extra dev pytest tests/method tests/coding/domain/test_coding_domain_app.py -q
uv --cache-dir .uv-cache run --extra dev ruff check src/loushang/method tests/method

Lane Brief / 执行说明

Lane: method

For human executors:

  • Follow repository/workspace AGENTS.md lane rules.
  • Use the method lane worktree and a task branch based on current main / origin/main.
  • Start with git status --short --branch.
  • Preserve unrelated dirty changes.
  • Prefer opening the PR as Draft first; convert to Ready only after targeted verification and review have no P0/P1 findings.

For the method lane agent:

  • You are the method lane agent.
  • Resolve the actual worktree from Lane: method; do not assume an absolute path.
  • Keep the change narrow. This is a compiler/projector contract slice, not a skill execution feature.
  • Report changed files, contract decisions, verification commands/results, and any residual follow-up issues.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions