Skip to content

Ticket Intake

Enreign edited this page Mar 13, 2026 · 2 revisions

Ticket Intake

Sparks can poll external project management systems and webhook endpoints for new work items, automatically dispatching them as autonomous tasks to appropriate ghosts. Completed tasks write results back to the source ticket.


Overview

Source (Linear / Webhook / ...)
  → Poll or receive webhook event
    → Validate + prompt-scan intake
      → Create AutonomousTask
        → Dispatch to ghost
          → Outcome (success / rollback)
            → Write-back result to ticket

Configuration

[ticket_intake]
enabled = true
sources = ["linear"]   # active sources

Linear

[ticket_intake.linear]
enabled            = true
poll_interval_secs = 60
project_ids        = ["PROJECT_ID_1", "PROJECT_ID_2"]
status_filter      = ["Todo", "In Progress"]
assignee_filter    = ["bot-user"]   # optional: only pick up tickets assigned to this user

Auth: Set LINEAR_API_KEY in environment or .env.

export LINEAR_API_KEY=lin_api_...

Write-back: When a task completes, Sparks updates the ticket status (e.g., In ProgressDone) and posts a comment with the outcome summary.


Webhook

[ticket_intake.webhook]
enabled   = true
bind      = "127.0.0.1:8788"
secret    = ""   # HMAC secret for signature verification (use env var)

Set the webhook secret via environment or keyring:

export SPARKS_WEBHOOK_SECRET=...
# or
sparks secrets set webhook.secret

The webhook endpoint accepts POST requests in a standard envelope format:

{
  "title": "Fix the login bug",
  "description": "Users can't log in with OAuth providers.",
  "repo": "Enreign/myapp",
  "risk_tier": "medium",
  "labels": ["bug", "auth"]
}

Task Construction

When a ticket is received, Sparks constructs an AutonomousTask with:

Field Source
goal Ticket title + description
repo From ticket metadata or config default
risk_tier From ticket labels or config default
ghost Classified automatically based on task content

The task then enters the standard dispatch queue and executes via the assigned ghost.


Prompt Scanning at Intake

All incoming tickets are scanned by the prompt scanner before dispatch. This prevents malicious content in external tickets from being executed as task goals.

Configure scanner behavior for intake specifically:

[prompt_scanner]
enabled   = true
mode      = "block"      # "block" is recommended for external intake
threshold = 0.6

See Sandboxing-and-Safety for scanner configuration options.


Makefile Shortcut

make user-flow

Runs the full Linear ticket intake + writeback harness locally. Useful for end-to-end testing without a running Sparks instance.


Relevant Source Files

  • src/ticket_intake/ — intake provider implementations
  • src/core.rs — task dispatch from intake events
  • src/kpi.rs — outcome recording for intake tasks
  • src/prompt_scanner.rs — intake-level scanning

Clone this wiki locally