Commit Graph

174 Commits

Author SHA1 Message Date
ezl-keygraph
e29d5b88a0 Merge pull request #177 from KeygraphHQ/feat/model-tiers
feat: add three-tier model system with Bedrock and Vertex AI support
2026-03-03 22:40:29 +05:30
ezl-keygraph
6a76df2f4c feat: add Google Vertex AI support with service account auth 2026-03-03 02:42:46 +05:30
ezl-keygraph
3ec491b30b chore: update pipeline testing vulnerability prompts 2026-03-03 02:05:09 +05:30
ezl-keygraph
b62abfea4c feat: add three-tier model system with Bedrock support
Introduce small/medium/large model tiers so agents use the appropriate
model for their task complexity. Pre-recon uses Opus (large) for deep
source code analysis, most agents use Sonnet (medium), and report uses
Haiku (small) for summarization.

- Add src/ai/models.ts with ModelTier type and resolveModel()
- Add modelTier field to AgentDefinition
- Refactor claude-executor env var passthrough into loop
- Add Bedrock credential validation in preflight and CLI
- Pass through Bedrock and model env vars in docker-compose
2026-03-03 01:08:26 +05:30
Arjun Malleswaran
98e3446448 Merge pull request #161 from KeygraphHQ/feat/pipeline-config
feat: add configurable pipeline retry and concurrency settings
2026-02-24 10:52:52 -08:00
ajmallesh
a03bc7506c chore: improve PR command summary format with rich bullet style 2026-02-24 09:31:37 -08:00
ajmallesh
d67c07dc55 feat: add configurable pipeline retry and concurrency settings (#157)
- Add `pipeline` config section with `retry_preset` and `max_concurrent_pipelines` options
- Add `subscription` retry preset with extended 6h max interval for Anthropic rate limit windows
- Replace Promise.allSettled with concurrency-limited runner for vuln/exploit pipelines
- Wire pipeline config through client, shared types, and workflow activity proxy selection
2026-02-24 09:31:33 -08:00
Arjun Malleswaran
91f03242a5 Merge pull request #160 from KeygraphHQ/chore/update-readme-banner
chore: update README banner image
2026-02-24 09:15:17 -08:00
ajmallesh
17d12be2ab chore: update README banner image 2026-02-24 09:11:50 -08:00
ezl-keygraph
6b403d59a7 Merge pull request #152 from KeygraphHQ/fix/router-env-passthrough
fix: pass router env vars to SDK subprocess
2026-02-21 02:24:29 +05:30
ezl-keygraph
742b74c86f fix: pass router env vars to SDK subprocess
ANTHROPIC_BASE_URL and ANTHROPIC_AUTH_TOKEN were not forwarded to the
SDK subprocess environment, causing router mode to fail with
"Authentication failed: Invalid API key" as the subprocess hit
Anthropic directly with the placeholder key.
2026-02-21 02:16:19 +05:30
ezl-keygraph
eaa817ea64 Merge pull request #149 from KeygraphHQ/fix/preflight-validation
feat: add preflight validation phase with structured error reporting
2026-02-20 21:50:31 +05:30
ajmallesh
839686c23c refactor: use SDK-exported SDKAssistantMessageError instead of local type definition 2026-02-20 07:49:53 -08:00
ezl-keygraph
e8e830c9f8 refactor: replace HTTP credential checks with Claude Agent SDK query
Replaces validateApiKey and validateOAuthToken (direct fetch calls) with
a single SDK-based query using claude-haiku-4-5-20251001. Uses
SDKAssistantMessageError types for structured error classification and
returns human-readable error messages for each failure case.
2026-02-20 17:06:59 +05:30
ajmallesh
7ecf5abb35 refactor: extract error formatting utilities from workflows.ts into workflow-errors.ts 2026-02-19 22:20:20 -08:00
ajmallesh
c0d46cb6b9 feat: add preflight validation phase with structured error reporting
- Add preflight activity that validates repo path, config, and credentials before agent execution
- Add formatWorkflowError() with pipe-delimited segments for multi-line log rendering
- Add remediation hints for common failures (auth, billing, config errors)
- Add REPO_NOT_FOUND, AUTH_FAILED, BILLING_ERROR codes with error classification
- Add formatErrorBlock() in WorkflowLogger for indented error display
2026-02-19 19:09:02 -08:00
Arjun Malleswaran
afa0e9b701 Merge pull request #141 from KeygraphHQ/refactor/architecture
refactor: decompose activities into services layer with structured error handling
2026-02-17 12:22:23 -08:00
ezl-keygraph
7fb0c30769 Merge pull request #142 from KeygraphHQ/docs/wsl-setup-guide
docs: add WSL2 setup guide for Windows users
2026-02-18 00:56:48 +05:30
ezl-keygraph
1e3f709423 docs: add WSL2 setup guide for Windows users 2026-02-17 18:03:45 +05:30
ajmallesh
a960ad1182 refactor: add numbered step comments to 20 complex sequential functions
- Add // N. Description steps to temporal layer (client, activities, workflows)
- Add steps to AI layer (claude-executor: runClaudePrompt, buildMcpServers)
- Add steps to services layer (prompt-manager, config-parser, git-manager)
- Add steps to audit layer (metrics-tracker, audit-session)
- Update CLAUDE.md comment guidelines with clearer numbered-step vs section-divider guidance
2026-02-16 20:45:58 -08:00
ajmallesh
d696a7584b refactor: extract helpers from long functions in client, workflows, and agent-execution
- client.ts: extract parseCliArgs, resolveWorkspace, buildPipelineInput, display helpers, waitForWorkflowResult from startPipeline
- workflows.ts: extract runSequentialPhase, buildPipelineConfigs, aggregatePipelineResults to reduce workflow body
- agent-execution.ts: add failAgent private method to deduplicate rollback+audit+error pattern in steps 6-8
2026-02-16 18:53:22 -08:00
ajmallesh
413c47af5c docs: update CLAUDE.md and commands for services-layer architecture 2026-02-16 18:15:52 -08:00
ajmallesh
16de74e0be refactor: remove ~70 low-value comments across 13 files
- Remove empty section markers (// === ... ===, // --- ... ---) that duplicate JSDoc or function names
- Remove "what" comments that restate the next line of code (e.g. // Save to disk, // Check for retryable patterns)
- Remove file-level descriptions that restate the filename (e.g. // Pure functions for formatting console output)
- Fix "Added by client" comment referencing implementation history → "Used for audit correlation"
- Preserve all WHY comments: error classification groups, billing/session limit explanations, ESM interop, exactOptionalPropertyTypes, mutex reasoning
2026-02-16 18:08:11 -08:00
ajmallesh
b208949345 refactor: consolidate file layout and break circular dependencies
- Move error-handling, git-manager, prompt-manager, queue-validation, and reporting into src/services/
- Delete src/constants.ts — relocate AGENT_VALIDATORS and MCP_AGENT_MAPPING into session-manager.ts alongside agent definitions
- Delete src/utils/output-formatter.ts — absorb filterJsonToolCalls and getAgentPrefix into ai/output-formatters.ts
- Extract ActivityLogger interface into src/types/activity-logger.ts to break temporal/ → services circular dependency
- Consolidate VulnType, ExploitationDecision into types/agents.ts and SessionMetadata into types/audit.ts
- Remove dead timingResults/costResults globals from utils/metrics.ts and all consumers
2026-02-16 18:01:37 -08:00
ajmallesh
9074149778 feat: add resume header to workflow.log showing previous workflow ID and checkpoint 2026-02-16 17:21:12 -08:00
ajmallesh
bb89d6f458 refactor: replace console.log/chalk with ActivityLogger across services
- Add ActivityLogger interface wrapping Temporal's Context.current().log
- Thread logger parameter through claude-executor, message-handlers, git-manager, prompt-manager, reporting, and agent validators
- Remove chalk dependency from all service/activity files; CLI files keep console.log for terminal output
- Replace colorFn: ChalkInstance parameter with structured logger.info/warn/error calls
- Use replay-safe `log` import from @temporalio/workflow in workflows.ts
2026-02-16 17:16:27 -08:00
ajmallesh
d3816a29fa refactor: extract services layer, Result type, and ErrorCode classification
- Add DI container (src/services/) with AgentExecutionService, ConfigLoaderService, and ExploitationCheckerService — pure domain logic with no Temporal dependencies
- Introduce Result<T, E> type and ErrorCode enum for code-based error classification in classifyErrorForTemporal, replacing scattered string matching
- Consolidate billing/spending cap detection into utils/billing-detection.ts with shared pattern lists across message-handlers, claude-executor, and error-handling
- Extract LogStream abstraction for append-only logging with backpressure, used by both AgentLogger and WorkflowLogger
- Simplify activities.ts from inline lifecycle logic to thin wrappers delegating to services, with heartbeat and error classification
- Expand config-parser with human-readable AJV errors, security validation, and rule type-specific checks
2026-02-16 16:12:21 -08:00
ajmallesh
ae69478541 refactor: consolidate duplicate types and file I/O utilities
- Remove 4 duplicate file I/O functions from audit/utils.ts, re-export from utils/file-io.ts
- Consolidate AgentEndResult interface into new types/audit.ts
- Use exported AgentDefinition from types/agents.ts in session-manager.ts
- Rename AgentMetrics to AgentAuditMetrics to disambiguate from temporal/shared.ts
2026-02-16 12:08:51 -08:00
ajmallesh
8e4fafba99 refactor: remove ~275 lines of dead code and enable stricter tsconfig
- Delete unused src/cli/ui.ts, remove zod dependency, drop 4 dead functions (logError, handleToolError, getRetryDelay, displayTimingSummary)
- Remove 8 unused types/interfaces and 3 duplicate formatting utils from audit/utils.ts
- Narrow export surface: make 7 message-handler functions private, remove unused audit re-exports, unexport AgentDefinition and path constants
- Remove unused runClaudePrompt params (sessionMetadata, attemptNumber) and update caller
- Enable tsconfig noUnusedLocals, noUnusedParameters, noImplicitReturns, noImplicitOverride, noFallthroughCasesInSwitch
2026-02-16 11:55:59 -08:00
ajmallesh
13731f5ebf refactor: remove ~750 lines of dead code across 12 files
- Delete 4 dead files: pre-recon.ts, tool-checker.ts, input-validator.ts, environment.ts
- Remove runClaudePromptWithRetry() and its now-unused imports from claude-executor.ts
- De-export unused symbols: AGENT_ORDER, getParallelGroups, logError, isRouterMode, showHelp, displayTimingSummary
- De-export unused types: ProcessingState, ProcessingResult, SdkMessage, MessageDispatchResult, MessageDispatchContext
- Remove dead import (path from zx) in session-manager.ts and deprecated comment in config.ts
2026-02-16 11:30:00 -08:00
ezl-keygraph
3a07f8a81f Merge pull request #140 from KeygraphHQ/feat/resume-workspace
feat: add named workspaces with resume support
2026-02-17 00:23:23 +05:30
ezl-keygraph
45e9f305ea refactor: remove ./shannon query CLI command
Query functionality is redundant with the Temporal Web UI
at http://localhost:8233. Removes query.ts, CLI handler,
npm script, and all documentation references.
2026-02-16 10:51:08 -08:00
ajmallesh
539bd873cc fix: improve resume edge cases and shell quoting
- Early exit when all agents already completed instead of running empty workflow
- Descriptive error when deliverables missing from disk despite session.json success
- Quote $WORKSPACE in shannon CLI to prevent word splitting
2026-02-16 10:50:52 -08:00
ezl-keygraph
c8bc29c011 Merge pull request #139 from KeygraphHQ/feat/windows-compat-and-claude-cli
feat: add MSYS path fix, Claude Code CLI, and Windows instructions
2026-02-16 23:14:15 +05:30
ezl-keygraph
759c8d8093 fix: resolve named workspace workflow ID in logs command
Strip _shannon-* suffix from workflow IDs so logs command finds
audit-logs stored under the workspace name.
2026-02-16 20:25:09 +05:30
ezl-keygraph
e85f6e0c73 feat: add MSYS path fix, Claude Code CLI, and Windows instructions
- Prevent MSYS from converting Unix container paths on Windows
- Install @anthropic-ai/claude-code globally in the Docker image
- Add Windows platform instructions to README
2026-02-16 20:11:08 +05:30
ezl-keygraph
2cf237d638 fix: resolve resume workflow ID in logs command
Strip _resume_* suffix to find the original workspace log file when
tailing logs for a resumed workflow.
2026-02-14 02:56:57 +05:30
ezl-keygraph
1b696cac1b fix: store checkpoint as success commit hash and show cumulative metrics
- Swap commitGitSuccess/getGitCommitHash order so checkpoint in
  session.json points to the success commit (which contains deliverables)
  instead of the pre-agent marker commit
- Simplify restoreGitCheckpoint: git reset --hard now naturally preserves
  completed agent deliverables, removing the in-memory backup/restore
- Show cumulative cost/duration in workflow.log from session.json
- Fill in per-agent metrics for skipped agents in workflow.log breakdown
- Display cumulative cost in client output for resume runs
2026-02-14 02:52:11 +05:30
ezl-keygraph
7f9c5cc496 fix: copy deliverables to audit-logs once at workflow end instead of per-agent
Moves the copyDeliverablesToAudit call from runAgentActivity (called after
every agent) to logWorkflowComplete (called once at workflow end). This
prevents intermediate agent runs from copying incomplete or rogue deliverables
into the audit trail.
2026-02-14 01:21:02 +05:30
ezl-keygraph
dbcb4587ee fix: update session.json status on workflow completion
logWorkflowComplete wrote to workflow.log but never called
updateSessionStatus, leaving all workspaces stuck as "in-progress"
in session.json. Also derive audit path for model injection instead
of requiring explicit outputPath.
2026-02-13 22:41:07 +05:30
ezl-keygraph
f017a41436 fix: set originalWorkflowId in logPhaseTransition and remove path import from agents.ts
logPhaseTransition was the first activity to create session.json but
didn't pass workflowId, so originalWorkflowId was never set. This
caused terminateExistingWorkflows to look up the workspace name instead
of the actual workflow ID during resume.

Also remove path import from types/agents.ts to fix Temporal workflow
bundle determinism error.
2026-02-13 22:09:07 +05:30
ezl-keygraph
ee5d7b80a0 feat: add named workspaces and workspace listing
Support WORKSPACE=<name> flag for friendly workspace names that
auto-resume if they exist or create a new named workspace otherwise.
Add ./shannon workspaces command to list all workspaces with status,
duration, and cost.
2026-02-13 20:53:18 +05:30
ezl-keygraph
f932fad2ed feat: add workflow resume from workspace via --workspace flag
When a workflow is interrupted (VM crash, Ctrl+C, Docker restart), it can
now be resumed by passing the workspace name. The system reads session.json
to determine which agents completed, validates deliverables exist on disk,
restores the git checkpoint, and skips already-completed agents.

- Add --workspace CLI flag and auto-terminate conflicting workflows
- Add loadResumeState, restoreGitCheckpoint, recordResumeAttempt activities
- Add skip logic for all 5 pipeline phases including parallel execution
- Separate sessionId (persistent directory) from workflowId (execution ID)
- Track resume attempts in session.json for audit trail
- Derive AgentName type from ALL_AGENTS array to eliminate duplication
- Add getDeliverablePath mapping for deliverable validation
2026-02-13 20:26:16 +05:30
Arjun Malleswaran
ce2628f6f0 Merge pull request #127 from KeygraphHQ/fix/large-deliverable-handling-v2
fix: improve large deliverable handling and audit trail
2026-02-12 08:54:19 -08:00
ezl-keygraph
c169b0d0a6 fix: restore CLAUDE_CODE_MAX_OUTPUT_TOKENS env var support
Re-add the env var that was removed during SDK upgrade. Needed for
controlling output token limits in SDK subprocesses.
2026-02-12 08:51:39 -08:00
ajmallesh
80bc8e3a44 feat: copy deliverables to audit-logs for self-contained audit trail 2026-02-12 08:51:39 -08:00
ajmallesh
30b5522647 fix: add chunked writing instructions to all agent prompts
- Replace single-call "Write to deliverables/" pattern with multi-step
  Write + Edit chunked writing across all 12 agent prompts
- Standardize section name to "CHUNKED WRITING (MANDATORY)" for
  vuln, exploit, pre-recon, and recon agents
- Prevents agents from hitting 32K output token limit when generating
  large analysis reports and exploitation evidence
2026-02-12 08:51:38 -08:00
Arjun Malleswaran
2f4fa89e7b fix: add file_path parameter to save_deliverable for large reports (#123)
* fix: add file_path parameter to save_deliverable for large reports

Large deliverable reports can exceed output token limits when passed as
inline content. This change allows agents to write reports to disk first
and pass a file_path instead.

Changes:
- Add file_path parameter to save_deliverable MCP tool with path
  traversal protection
- Pass CLAUDE_CODE_MAX_OUTPUT_TOKENS env var to SDK subprocesses
- Fix false positive error detection by extracting only text content
  (not tool_use JSON) when checking for API errors
- Update all prompts to instruct agents to use file_path for large
  reports and stop immediately after completion

* docs: simplify and condense CLAUDE.md

Reduce verbosity while preserving all essential information for AI
assistance. Makes the documentation more scannable and focused.

* feat: add issue number detection to pr command

The /pr command now automatically detects issue numbers from:
1. Explicit arguments (e.g., /pr 123 or /pr 123,456)
2. Branch name patterns (e.g., fix/123-bug, issue-456-feature)

Adds "Closes #X" lines to PR body to auto-close issues on merge.

* chore: remove CLAUDE_CODE_MAX_OUTPUT_TOKENS env var handling

No longer needed with the new Claude Agent SDK version.

* fix: restore max_output_tokens error handling
2026-02-11 13:40:49 -08:00
ezl-keygraph
2e1fe3454a chore: migrate issue templates to GitHub issue forms (#119)
Replace markdown-based issue templates with YAML issue forms for
structured input with dropdowns, checkboxes, and required fields.
2026-02-11 19:02:36 +05:30
ezl-keygraph
a5daa07178 fix: auto-detect Podman to avoid host-gateway incompatibility (#117)
Podman doesn't support the `host-gateway` special value in extra_hosts,
which causes container startup failures on macOS with Podman Desktop.

Changes:
- Add docker-compose.docker.yml with extra_hosts override for Docker
- Update shannon script to detect Podman via `command -v podman`
- Skip extra_hosts override when Podman is detected

This ensures:
- Docker users (Linux): Get host.docker.internal working automatically
- Podman users (macOS): Base config works without modification

Co-authored-by: ajmallesh <ajmallesh@gmail.com>
2026-02-11 01:51:48 +05:30