Arguments & Input Mapping
Cognitive Modules supports two ways to pass input:
- Structured JSON via
--input(recommended) - Free-form text via
--args
Structured Input (--input)
npx cogn@2.2.12 run code-reviewer --input '{"query":"review this code"}'
Fields in input are available to prompts via ${variable} placeholders, for example ${query}.
Text Input (--args)
npx cogn@2.2.12 run code-reviewer --args "def foo(): pass"
--args is mapped to:
input.codeif it looks like code- otherwise
input.query
Prompt Substitution
The runtime supports legacy placeholders in prompt.md:
$ARGUMENTS(full args string)$ARGUMENTS[N](index access)$N(shorthand index)
If the prompt does not include args explicitly, the runtime appends a short input section automatically.