Skip to content

Consolidate audit prompt resolution logic #23

Closed

Description

@dominicnunez

Problem

The audit prompt resolution is handled across multiple locations with unclear priority:

  1. CLI --audit-prompt flag
  2. Config willie.audit-prompt (file path)
  3. Project file audit/prompt.md
  4. Global file ~/.config/sfk/audit-prompt.md
  5. Built-in default

The confusion is that there are two different mechanisms that overlap:

  • willie.audit-prompt in config (explicit path setting)
  • Hardcoded check for ~/.config/sfk/audit-prompt.md (implicit global location)

This creates ambiguity. If someone sets willie.audit-prompt = /my/path.md but also has ~/.config/sfk/audit-prompt.md, the config wins - but the relationship isn't documented clearly.

Current Code

// audit.ts:119-143
function resolveAuditPrompt(auditPromptPath: string | undefined): ResolvedPrompt {
  // 1. CLI flag (passed via config.willieAuditPrompt merged with CLI)
  if (auditPromptPath && existsSync(auditPromptPath)) { ... }
  
  // 2. Project file (hardcoded location)
  const projectPrompt = join(AUDIT_DIR, "prompt.md");
  if (existsSync(projectPrompt)) { ... }
  
  // 3. Global file (hardcoded location)
  const globalPrompt = join(homedir(), ".config", "sfk", "audit-prompt.md");
  if (existsSync(globalPrompt)) { ... }
  
  // 4. Built-in default
  return { text: DEFAULT_AUDIT_PROMPT, source: "built-in default" };
}

Proposed Solution

Remove the hardcoded global file path (~/.config/sfk/audit-prompt.md) and rely solely on:

  1. CLI --audit-prompt
  2. Config willie.audit-prompt
  3. Project audit/prompt.md
  4. Built-in default

This keeps the resolution to 4 clear sources, all configurable via documented settings. The global config already supports willie.audit-prompt, so users can point to any file they want.

Alternative

Keep all 5 but document the priority clearly in config.example and README.

Activity

  1. dominicnunez commented on Feb 21, 2026

    @dominicnunez
    OwnerAuthor

    Closed as duplicate of #24 - Phase 4 (Audit Pipeline) addresses this with consolidated audit prompt resolution: CLI flag → config → project file → built-in default, with documented priority.

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

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions