matthewwong525/WongStack / .agents/plugins/memory
memory
Verifiedscripts/lib/headless.mjs
View on GitHub// The command line of one headless agent run, for Claude Code or Codex. A narrow grant names the tools, folder and
// writable roots it may use, as the memory run does; `full` bypasses permissions, as a daily background run does.
/** `[command, args]` for `agent` ('claude' or 'codex'); `access` is `{ full: true }` or `{ tools, dir, writable }`;
* `readOnly` with `tools` and `dir` lets Codex write nothing; `deny` lists tool patterns a full Claude run refuses. */
export function headlessCommand({ agent, prompt, model, access, deny = [] }) {
if (agent === 'codex') {
const sandbox = access.full ? ['--dangerously-bypass-approvals-and-sandbox'] : access.readOnly ? ['--sandbox', 'read-only']
: ['--sandbox', 'workspace-write', '-c', 'sandbox_workspace_write.network_access=true',
'-c', `sandbox_workspace_write.writable_roots=[${access.writable.map(root => JSON.stringify(root)).join(',')}]`];
return ['codex', ['exec', '--ephemeral', '--skip-git-repo-check', ...(model ? ['-m', model] : []), ...sandbox, '-c', 'approval_policy="never"', prompt]];
}
// --disallowedTools takes many values, so it goes last, where it can swallow no later option.
const grant = access.full ? ['--permission-mode', 'bypassPermissions', '--output-format', 'stream-json', '--verbose',
...(deny.length ? ['--disallowedTools', ...deny] : [])]
: ['--permission-mode', 'dontAsk', '--allowedTools', ...access.tools, '--add-dir', access.dir];
return ['claude', ['-p', prompt, ...(model ? ['--model', model] : []), '--no-session-persistence', ...grant]];
}
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| slack-gif-creatoranthropics/skillsKnowledge and utilities for creating animated GIFs optimized for Slack. Provides constraints, validation tools, and animation concepts. Use when users request animated GIFs for Slack like "make me a GIF of X doing Y for Slack." | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |
| ponytailDietrichGebert/ponytailLazy senior dev mode for any coding task: the smallest change that fully solves it, and a reply a busy human understands in one read. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-debtDietrichGebert/ponytailHarvest every shortcut: comment into one debt ledger, so deferrals get tracked instead of forgotten. One-shot report. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-debtDietrichGebert/ponytailList every `shortcut:` comment (and older `ponytail:` ones) as a debt ledger. One-shot report, changes nothing. Use for "ponytail debt", "what did ponytail defer", "list the shortcuts", /ponytail-debt. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |