Documents
quick-reference
quick-reference
Type
External
Status
Published
Created
Feb 27, 2026
Updated
Mar 28, 2026
Updated by
Dosu Bot

CipherSwarm Quick Reference#

Commands#

CommandDescription
just devStart development server
just testRun all tests with coverage
just test-file spec/path.rbRun specific test
just checkLint + security checks
just formatAuto-format code
just db-migrateRun migrations
just db-rollbackRollback migration
just consoleRails console
just docs-apiGenerate API docs

File Locations#

WhatWhere
Modelsapp/models/
API Controllersapp/controllers/api/v1/client/
Servicesapp/services/
Jobsapp/jobs/
Componentsapp/components/
Factoriesspec/factories/
System Testsspec/system/
API Testsspec/requests/

Domain Hierarchy#

Project → Campaign → Attack → Task → Agent
        HashList → HashItem

State Machines#

Agent#

pending → active → benchmarked → error/stopped

Attack#

pending → running → completed/exhausted/failed/paused

Task#

pending → running → completed/exhausted/failed/paused

API Endpoints#

MethodEndpointPurpose
GET/authenticateVerify token
GET/configurationAgent config
GET/agents/{id}Agent details
PUT/agents/{id}Update agent
POST/agents/{id}/heartbeatKeep alive
POST/agents/{id}/submit_benchmarkSubmit benchmarks
POST/agents/{id}/submit_errorReport error
POST/agents/{id}/shutdownShutdown
GET/tasks/newGet new task
POST/tasks/{id}/accept_taskAccept task
POST/tasks/{id}/submit_statusUpdate progress
POST/tasks/{id}/submit_crackSubmit crack
POST/tasks/{id}/exhaustedMark complete
POST/tasks/{id}/abandonAbandon task
GET/tasks/{id}/get_zapsGet cracked hashes
GET/attacks/{id}Attack details
GET/attacks/{id}/hash_listDownload hashes

Authentication#

Authorization: Bearer <24-char-token>

Campaign Priorities#

PriorityValueEffect
flash_override5Highest, preempts all
flash4Very high
immediate3High
urgent2Above normal
priority1Normal
routine0Default
deferred-1Lowest

Attack Modes#

ModeHashcatDescription
dictionary0Wordlist attack
mask3Brute force with mask
hybrid_dictionary6Wordlist + mask
hybrid_mask7Mask + wordlist

Logging Prefixes#

[APIRequest] - API requests
[APIError] - API errors
[AgentLifecycle] - Agent state changes
[BroadcastError] - WebSocket errors
[TaskPreemption] - Task preemption
[JobDiscarded] - Failed jobs

Testing#

# All tests
COVERAGE=true bundle exec rspec

# Single file
bundle exec rspec spec/models/task_spec.rb

# Single test (line 42)
bundle exec rspec spec/models/task_spec.rb:42

# System tests (visible browser)
HEADLESS=false bundle exec rspec spec/system

# API tests only
bundle exec rspec spec/requests

FactoryBot#

# Basic
create(:task)
build(:agent)

# With traits
create(:agent, :benchmarked)
create(:task, :running)
create(:campaign, :high_priority)

# With overrides
create(:task, state: "completed", agent: my_agent)

Common Patterns#

Service Object#

class MyService
  def initialize(model)
    @model = model
  end

  def call
    # Business logic
  end
end

# Usage
MyService.new(model).call

Controller Authorization#

class MyController < ApplicationController
  load_and_authorize_resource

  def index
    @items = @items.page(params[:page])
  end
end

API Response#

# Success with body
render json: @task, status: :ok

# Success no body
head :no_content

# Error
render json: { error: "Message" }, status: :unprocessable_entity

Transaction#

Model.transaction do
  record.lock!
  record.update!(field: value)
end

URLs#

EnvironmentURL
Developmenthttp://localhost:3000
API Docshttp://localhost:3000/api-docs
Adminhttp://localhost:3000/admin
Sidekiqhttp://localhost:3000/sidekiq

Key Files#

FilePurpose
AGENTS.mdDeveloper conventions
justfileTask runner commands
config/routes.rbApplication routes
app/models/ability.rbAuthorization rules
spec/swagger_helper.rbAPI doc config
config/initializers/sidekiq.rbJob config