Skip to content

[feature] harness prompt delivery: stdin / embedded placeholders and verified invoke templates #27

Open

Description

@smota

Summary

Split from #9 (items 5–6 of its suggested fixes). After #9, a harness is probed with a bounded deadline and is only dispatchable with an invoke_args_template. But the template still can't pass the prompt the way real CLIs expect it, so live dispatch of claude, codex, grok, pi and agy still needs a wrapper script per harness.

Problem

CliHarness::invoke (crates/meshloop-adapters/src/harness.rs):

  • substitutes {prompt_file} only when it is a whole argument (no --prompt-file={prompt_file});
  • has no way to pass the prompt text ({prompt}), which claude -p "<prompt>" and codex exec "<prompt>" expect;
  • always uses stdin(Stdio::null()), so CLIs that read the prompt from stdin cannot be used.

Proposed scope

  1. A config option such as prompt_via = "stdin" | "arg" | "file" (default file keeps current behaviour).
  2. Embedded placeholder substitution inside arguments ("--prompt-file={prompt_file}").
  3. Decide whether a {prompt} text placeholder is acceptable (argv length limits on Windows ~32 KiB; quoting; secrets in process listings). Stdin may be the safer default.
  4. Per-harness invoke_args_template examples in config/meshloop.example.toml and docs/install.md, verified against each CLI's own help/docs, not guessed. ADR 0003 forbids hardcoded flags in code; documented examples in config must still be checked.

Acceptance criteria

  • A fixture-harness contract test for each delivery mode (stdin, embedded file placeholder).
  • meshloop doctor reports a harness with a verified template as dispatchable.
  • The example config documents which templates were verified, and against which CLI versions.

Notes

Public config contract change: consider whether it needs an ADR 0003 amendment.


🤖 Generated with Claude Code

Activity

  1. added
    drafted-by:claudeIssue, plan, or spec drafted by Claude in the current session
    on Oct 7, 2026
  2. smota commented on Oct 7, 2026

    @smota
    OwnerAuthor

    A data point for the "verified invoke templates" part of this issue, from the issues-46-47-56 run (PR #63):

    The Claude worker was started through a PowerShell shim:

    claude -p --model sonnet --permission-mode acceptEdits --allowedTools "Read" "Edit" "Write" "Glob" "Grep" "Bash(cargo:*)" …
    

    The worker still couldn't run cargo. The log of attempt 5 says: "cargo fmt --all was denied in both the Bash and PowerShell tools ("requires approval")". On Windows, Claude Code runs commands through its PowerShell tool, which Bash(...) rules don't cover. The :* prefix form may not match either.

    The result: three worker attempts in a row produced correct logic but never ran fmt, clippy or tests, and each failed verification on formatting or lint. Because worker output isn't saved (#48), it looked as if the workers were ignoring their instructions.

    A verified Claude template should therefore:

    • allow the build and test commands under both tools, e.g. Bash(cargo *) and PowerShell(cargo *), checked against the installed Claude Code version
    • include a smoke step in doctor that asks the harness to run a harmless allowed command (e.g. cargo --version) and fails if it's denied

    🤖 Generated with Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    drafted-by:claudeIssue, plan, or spec drafted by Claude in the current session

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions