@the-agenticflow/openflows 0.1.6 → 0.1.8-dev.236.2151055

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (87) hide show
  1. package/bin/openflows-dashboard.js +1 -1
  2. package/bin/openflows-setup.js +1 -1
  3. package/bin/openflows.js +4 -286
  4. package/package.json +3 -21
  5. package/scripts/install.js +59 -209
  6. package/.env.example +0 -60
  7. package/README.md +0 -217
  8. package/bin/LICENSE +0 -21
  9. package/bin/README.md +0 -535
  10. package/bin/agentflow-bin +0 -0
  11. package/bin/agentflow-dashboard-bin +0 -0
  12. package/bin/agentflow-doctor-bin +0 -0
  13. package/bin/agentflow-setup-bin +0 -0
  14. package/bin/orchestration/agent/agents/forge.agent.md +0 -110
  15. package/bin/orchestration/agent/agents/lore.agent.md +0 -27
  16. package/bin/orchestration/agent/agents/nexus.agent.md +0 -201
  17. package/bin/orchestration/agent/agents/sentinel.agent.md +0 -96
  18. package/bin/orchestration/agent/agents/vessel.agent.md +0 -38
  19. package/bin/orchestration/agent/registry.json +0 -10
  20. package/bin/orchestration/agent/standards/CODING.md +0 -22
  21. package/bin/orchestration/agent/standards/REVIEW.md +0 -15
  22. package/bin/orchestration/agent/standards/SECURITY.md +0 -72
  23. package/bin/orchestration/plugin/commands/assign.md +0 -45
  24. package/bin/orchestration/plugin/commands/check-ci.md +0 -26
  25. package/bin/orchestration/plugin/commands/document-pr.md +0 -32
  26. package/bin/orchestration/plugin/commands/gate-approve.md +0 -39
  27. package/bin/orchestration/plugin/commands/handoff.md +0 -75
  28. package/bin/orchestration/plugin/commands/merge.md +0 -47
  29. package/bin/orchestration/plugin/commands/plan.md +0 -66
  30. package/bin/orchestration/plugin/commands/segment-done.md +0 -50
  31. package/bin/orchestration/plugin/commands/status-check.md +0 -28
  32. package/bin/orchestration/plugin/commands/status.md +0 -94
  33. package/bin/orchestration/plugin/commands/update-changelog.md +0 -37
  34. package/bin/orchestration/plugin/hooks/forge/post_write_lint.sh +0 -76
  35. package/bin/orchestration/plugin/hooks/forge/pre_bash_guard.sh +0 -81
  36. package/bin/orchestration/plugin/hooks/forge/pre_compact_handoff.sh +0 -28
  37. package/bin/orchestration/plugin/hooks/forge/pre_write_check.sh +0 -77
  38. package/bin/orchestration/plugin/hooks/forge/session_start.sh +0 -59
  39. package/bin/orchestration/plugin/hooks/forge/stop_require_artifact.sh +0 -75
  40. package/bin/orchestration/plugin/hooks/lore/session-start.sh +0 -13
  41. package/bin/orchestration/plugin/hooks/nexus/init-session.sh +0 -23
  42. package/bin/orchestration/plugin/hooks/nexus/log-decision.sh +0 -10
  43. package/bin/orchestration/plugin/hooks/sentinel/post_write_validate.sh +0 -59
  44. package/bin/orchestration/plugin/hooks/sentinel/pre_bash_readonly_guard.sh +0 -107
  45. package/bin/orchestration/plugin/hooks/sentinel/session_start.sh +0 -74
  46. package/bin/orchestration/plugin/hooks/sentinel/stop_require_eval.sh +0 -57
  47. package/bin/orchestration/plugin/hooks/vessel/log-merge-status.sh +0 -7
  48. package/bin/orchestration/plugin/hooks/vessel/session-start.sh +0 -14
  49. package/bin/orchestration/plugin/mcp/mcp.json.template +0 -26
  50. package/bin/orchestration/plugin/plugin.json +0 -66
  51. package/bin/orchestration/plugin/skills/forge-algorithmic-art.md +0 -24
  52. package/bin/orchestration/plugin/skills/forge-canvas-design.md +0 -25
  53. package/bin/orchestration/plugin/skills/forge-coding.md +0 -161
  54. package/bin/orchestration/plugin/skills/forge-frontend-design.md +0 -30
  55. package/bin/orchestration/plugin/skills/forge-mcp-builder.md +0 -37
  56. package/bin/orchestration/plugin/skills/forge-planning.md +0 -102
  57. package/bin/orchestration/plugin/skills/forge-skill-creator.md +0 -25
  58. package/bin/orchestration/plugin/skills/forge-web-artifacts-builder.md +0 -29
  59. package/bin/orchestration/plugin/skills/lore-brand-guidelines.md +0 -33
  60. package/bin/orchestration/plugin/skills/lore-changelog.md +0 -69
  61. package/bin/orchestration/plugin/skills/lore-doc-coauthoring.md +0 -33
  62. package/bin/orchestration/plugin/skills/lore-documentation.md +0 -57
  63. package/bin/orchestration/plugin/skills/lore-docx.md +0 -20
  64. package/bin/orchestration/plugin/skills/lore-pdf.md +0 -20
  65. package/bin/orchestration/plugin/skills/lore-pptx.md +0 -23
  66. package/bin/orchestration/plugin/skills/lore-theme-factory.md +0 -20
  67. package/bin/orchestration/plugin/skills/lore-xlsx.md +0 -20
  68. package/bin/orchestration/plugin/skills/nexus-doc-coauthoring.md +0 -21
  69. package/bin/orchestration/plugin/skills/nexus-internal-comms.md +0 -28
  70. package/bin/orchestration/plugin/skills/nexus-orchestration.md +0 -63
  71. package/bin/orchestration/plugin/skills/nexus-skill-creator.md +0 -15
  72. package/bin/orchestration/plugin/skills/nexus-slack-gif-creator.md +0 -21
  73. package/bin/orchestration/plugin/skills/nexus-triage.md +0 -56
  74. package/bin/orchestration/plugin/skills/nexus-xlsx.md +0 -20
  75. package/bin/orchestration/plugin/skills/sentinel-algorithmic-art.md +0 -20
  76. package/bin/orchestration/plugin/skills/sentinel-criteria.md +0 -115
  77. package/bin/orchestration/plugin/skills/sentinel-frontend-design.md +0 -20
  78. package/bin/orchestration/plugin/skills/sentinel-review.md +0 -124
  79. package/bin/orchestration/plugin/skills/sentinel-web-artifacts-builder.md +0 -20
  80. package/bin/orchestration/plugin/skills/sentinel-webapp-testing.md +0 -34
  81. package/bin/orchestration/plugin/skills/shared-claude-api.md +0 -25
  82. package/bin/orchestration/plugin/skills/vessel-ci-gate.md +0 -68
  83. package/bin/orchestration/plugin/skills/vessel-internal-comms.md +0 -20
  84. package/bin/orchestration/plugin/skills/vessel-mcp-builder.md +0 -21
  85. package/bin/orchestration/plugin/skills/vessel-merge-protocol.md +0 -113
  86. package/bin/orchestration/plugin/skills/vessel-pdf.md +0 -20
  87. package/bin/orchestration/plugin/skills/vessel-webapp-testing.md +0 -34
@@ -1,75 +0,0 @@
1
- ---
2
- name: handoff
3
- description: Write a complete handoff for context reset
4
- ---
5
-
6
- # /handoff Command
7
-
8
- Writes a complete handoff and exits for context reset.
9
-
10
- ## When to Use
11
-
12
- When the PreCompact hook fires, or when you choose to reset
13
- context at a natural segment boundary.
14
-
15
- ## Steps
16
-
17
- 1. **Read Worklog**
18
- Read `WORKLOG.md` to summarize completed segments.
19
-
20
- 2. **Scan In-Progress**
21
- Check worktree for any in-progress files.
22
-
23
- 3. **Collect Decisions**
24
- Gather all decisions made (from WORKLOG.md).
25
-
26
- 4. **Write Handoff**
27
- Use `write_to_shared` MCP tool with:
28
- - artifact_type: `HANDOFF`
29
- - content: Must include:
30
- - Completed segments summary
31
- - In-progress work
32
- - Decisions made
33
- - **Exact next step** (required)
34
- - Files modified
35
- - Context needed for continuation
36
-
37
- 5. **Emit Event**
38
- Use `emit_event` MCP tool:
39
- - event_type: "context_reset"
40
- - message: "Context reset - handoff written"
41
-
42
- 6. **Exit**
43
- Exit cleanly. Harness will spawn fresh session.
44
-
45
- ## Handoff Template
46
-
47
- ```markdown
48
- # Handoff for T-{id}
49
-
50
- ## Completed Segments
51
- - Segment 1: {summary}
52
- - Segment 2: {summary}
53
-
54
- ## In-Progress
55
- - {What was being worked on}
56
-
57
- ## Decisions Made
58
- - {Decision 1}: {rationale}
59
- - {Decision 2}: {rationale}
60
-
61
- ## Exact Next Step
62
- {Specific, actionable next step}
63
-
64
- ## Files Modified
65
- - src/file1.rs
66
- - src/file2.rs
67
-
68
- ## Context Needed
69
- - {Any context the next session needs}
70
- ```
71
-
72
- ## Output
73
-
74
- Creates `shared/HANDOFF.md`
75
- Agent exits - harness spawns fresh session.
@@ -1,47 +0,0 @@
1
- ---
2
- name: merge
3
- description: Merge an approved PR after CI passes
4
- ---
5
-
6
- # /merge Command
7
-
8
- Merges an approved PR after all gates pass.
9
-
10
- ## When to Use
11
-
12
- When:
13
- - CI status is success
14
- - SENTINEL approval exists (final-review.md)
15
- - No merge conflicts
16
-
17
- ## Steps
18
-
19
- 1. **Verify CI**
20
- Use `check_ci_status` MCP tool.
21
- Must be `success`.
22
-
23
- 2. **Verify Approval**
24
- Check `final-review.md` exists with APPROVED verdict.
25
-
26
- 3. **Check for Conflicts**
27
- Verify PR has no merge conflicts.
28
-
29
- 4. **Merge PR**
30
- Use `merge_pr` MCP tool with:
31
- - pr_number: The PR number
32
- - merge_method: "squash" (recommended)
33
- - commit_message: From SENTINEL's PR description
34
-
35
- 5. **Report**
36
- Emit merge event and update NEXUS.
37
-
38
- ## Blocked If
39
-
40
- - CI is failing or pending
41
- - No SENTINEL approval
42
- - Merge conflicts exist
43
-
44
- ## Output
45
-
46
- PR merged into main.
47
- Worker slot set to Idle.
@@ -1,66 +0,0 @@
1
- # /plan Command
2
-
3
- Create a detailed implementation plan for the current ticket.
4
-
5
- ## Usage
6
-
7
- ```
8
- /plan
9
- ```
10
-
11
- ## What it does
12
-
13
- 1. Reads TICKET.md and TASK.md from the shared directory
14
- 2. Analyzes the codebase to understand the current state
15
- 3. Creates PLAN.md with:
16
- - Problem analysis
17
- - Solution approach
18
- - Segment breakdown with explicit deliverables
19
- - Risk assessment
20
- - Estimated segments
21
-
22
- ## Output
23
-
24
- Writes to `${SPRINTLESS_SHARED}/PLAN.md`:
25
-
26
- ```markdown
27
- # Implementation Plan: T-{id}
28
-
29
- ## Problem Analysis
30
- [What the ticket asks for and why]
31
-
32
- ## Solution Approach
33
- [High-level technical approach]
34
-
35
- ## Segment Breakdown
36
-
37
- ### Segment 1: {title}
38
- - Deliverable: {specific artifact}
39
- - Files to modify: [list]
40
- - Tests to write: [list]
41
- - Exit condition: {measurable state}
42
-
43
- ### Segment 2: {title}
44
- ...
45
-
46
- ## Risk Assessment
47
- - Risk 1: {description} - Mitigation: {strategy}
48
- - Risk 2: ...
49
-
50
- ## Estimated Segments
51
- Total: {N} segments
52
- ```
53
-
54
- ## After Planning
55
-
56
- Once PLAN.md is written:
57
- 1. Commit the plan: `git add -A && git commit -m "[T-{id}] plan: implementation approach"`
58
- 2. Begin Segment 1
59
- 3. Use `/segment-done` when each segment is complete
60
-
61
- ## Important
62
-
63
- - Each segment must have a clear, measurable exit condition
64
- - Plan conservatively - it's better to have more small segments than fewer large ones
65
- - The plan can be adjusted after segments if discovery reveals new information
66
- - Update WORKLOG.md as you work through segments
@@ -1,50 +0,0 @@
1
- ---
2
- name: segment-done
3
- description: Submit the current segment for SENTINEL review
4
- ---
5
-
6
- # /segment-done Command
7
-
8
- Submits the current segment to SENTINEL for evaluation.
9
-
10
- ## When to Use
11
-
12
- When you believe a segment is complete and ready for review.
13
-
14
- ## Steps
15
-
16
- 1. **Run Tests**
17
- Use `run_tests` MCP tool.
18
- - All tests must pass before continuing
19
- - If any fail, fix them first
20
-
21
- 2. **Run Linter**
22
- Use `run_linter` MCP tool.
23
- - Must be clean (zero warnings)
24
- - Fix any issues first
25
-
26
- 3. **Commit Segment**
27
- Use `commit_segment` MCP tool with:
28
- - segment_name: e.g., "segment-1"
29
- - description: Brief description of changes
30
-
31
- 4. **Update Worklog**
32
- Use `write_to_shared` MCP tool with:
33
- - artifact_type: `WORKLOG_ENTRY`
34
- - content: What was done, decisions made
35
-
36
- 5. **Emit Event**
37
- Use `emit_event` MCP tool:
38
- - event_type: "segment_submitted"
39
- - message: "Segment N submitted for evaluation"
40
-
41
- ## Blocked If
42
-
43
- - Any tests are failing
44
- - Any lint warnings exist
45
- - No files have been changed since last commit
46
-
47
- ## Output
48
-
49
- Updates WORKLOG.md, commits segment, notifies SENTINEL.
50
- Wait for `segment-N-eval.md` from SENTINEL.
@@ -1,28 +0,0 @@
1
- ---
2
- name: status-check
3
- description: Check the current system status
4
- ---
5
-
6
- # /status-check Command
7
-
8
- Returns the current system status including workers, tickets, and PRs.
9
-
10
- ## Output
11
-
12
- ```json
13
- {
14
- "workers": {
15
- "idle": 1,
16
- "assigned": 2,
17
- "working": 0,
18
- "suspended": 0,
19
- "done": 0
20
- },
21
- "tickets": {
22
- "pending": 5,
23
- "in_progress": 2
24
- },
25
- "open_prs": 1,
26
- "pending_approvals": 0
27
- }
28
- ```
@@ -1,94 +0,0 @@
1
- ---
2
- name: status
3
- description: Signal terminal status to the harness
4
- ---
5
-
6
- # /status Command
7
-
8
- Signal terminal status to the harness. Use when work is complete or blocked.
9
-
10
- ## Usage
11
-
12
- ```bash
13
- /status <status> [reason]
14
- ```
15
-
16
- ## Status Values
17
-
18
- ### Terminal statuses (ends the pair lifecycle)
19
- - `PR_OPENED` - Work complete, PR created
20
- - `COMPLETE` - All work done, PR creation deferred to harness
21
- - `BLOCKED` - Cannot proceed, needs intervention
22
- - `FUEL_EXHAUSTED` - Budget/tokens exhausted, need more allocation
23
-
24
- ### Non-terminal statuses (continues the event loop)
25
- - `PENDING_REVIEW` - Work paused, waiting for review
26
- - `AWAITING_SENTINEL_REVIEW` - Segment done, waiting for SENTINEL evaluation
27
- - `APPROVED_READY` - Changes requested by SENTINEL have been addressed
28
- - `SEGMENT_N_DONE` - Segment N complete (e.g. `SEGMENT_1_DONE`)
29
-
30
- ### IMPORTANT
31
- Do NOT use any other status value. Values like `AWAITING_REVIEW`, `DONE`, `FINISHED`, `SUCCESS`, `IMPLEMENTATION_COMPLETE` will be treated as `BLOCKED` and your work will be wasted.
32
-
33
- ## What it does
34
-
35
- 1. Writes STATUS.json with current state
36
- 2. Lists all files changed
37
- 3. Provides reason/explanation
38
- 4. Harness reads STATUS.json and takes appropriate action
39
-
40
- ## STATUS.json Structure
41
-
42
- ```json
43
- {
44
- "status": "PR_OPENED | COMPLETE | BLOCKED | FUEL_EXHAUSTED | PENDING_REVIEW | AWAITING_SENTINEL_REVIEW | APPROVED_READY | SEGMENT_N_DONE",
45
- "pair": "pair-{N}",
46
- "ticket_id": "T-{id}",
47
- "branch": "forge-{N}/T-{id}",
48
- "files_changed": [
49
- "src/auth.rs",
50
- "tests/auth_test.rs"
51
- ],
52
- "segments_completed": 3,
53
- "pr_url": "https://github.com/owner/repo/pull/42",
54
- "reason": "Optional reason for BLOCKED or FUEL_EXHAUSTED",
55
- "timestamp": "2025-03-24T10:00:00Z"
56
- }
57
- ```
58
-
59
- ## Examples
60
-
61
- ### Work Complete
62
-
63
- ```bash
64
- /status PR_OPENED
65
- ```
66
-
67
- Then provide the PR URL when prompted.
68
-
69
- ### Blocked
70
-
71
- ```bash
72
- /status BLOCKED Cannot proceed due to API rate limit
73
- ```
74
-
75
- ### Fuel Exhausted
76
-
77
- ```bash
78
- /status FUEL_EXHAUSTED Need 50k more tokens to complete
79
- ```
80
-
81
- ## After STATUS.json
82
-
83
- The harness will:
84
-
85
- - **PR_OPENED**: Notify VESSEL to check CI and merge
86
- - **BLOCKED**: Alert NEXUS for human intervention
87
- - **FUEL_EXHAUSTED**: Request more budget allocation
88
-
89
- ## Important
90
-
91
- - This is a terminal state - you cannot continue after writing STATUS.json
92
- - For temporary pauses, use `/segment-done` instead
93
- - For context reset, use `/handoff` instead
94
- - Always list ALL files changed across all segments
@@ -1,37 +0,0 @@
1
- ---
2
- name: update-changelog
3
- description: Add entry to CHANGELOG.md
4
- ---
5
-
6
- # /update-changelog Command
7
-
8
- Adds an entry to CHANGELOG.md for a merged PR.
9
-
10
- ## Steps
11
-
12
- 1. **Read PR Description**
13
- Get the PR description from the merge.
14
-
15
- 2. **Categorize Change**
16
- Determine category:
17
- - Added: New features
18
- - Changed: Modified behavior
19
- - Fixed: Bug fixes
20
- - Security: Security fixes
21
-
22
- 3. **Write Entry**
23
- Add to CHANGELOG.md under [Unreleased]:
24
- ```markdown
25
- ### Added
26
- - New feature X (#42)
27
- ```
28
-
29
- 4. **Commit**
30
- Commit with message:
31
- ```
32
- docs: update CHANGELOG for T-{id}
33
- ```
34
-
35
- ## Output
36
-
37
- CHANGELOG.md updated with new entry.
@@ -1,76 +0,0 @@
1
- #!/bin/bash
2
- # Runs after every Write, Edit, MultiEdit tool call
3
- # Validates atomic writes for shared/ artifacts and runs linter on source files
4
- #
5
- # Environment:
6
- # CLAUDE_TOOL_INPUT_FILE_PATH - the file that was written
7
- # SPRINTLESS_WORKTREE - the worktree directory
8
-
9
- FILE="${CLAUDE_TOOL_INPUT_FILE_PATH}"
10
- WORKTREE="${SPRINTLESS_WORKTREE}"
11
-
12
- # For shared/ artifacts, ensure atomic write was used (.tmp + rename pattern)
13
- case "$FILE" in
14
- */orchestration/pairs/*/shared/*)
15
- # Verify file was written atomically (should never see .tmp files at this point)
16
- if [[ "$FILE" == *.tmp ]]; then
17
- echo "ERROR: Temporary file leaked to filesystem: ${FILE}"
18
- echo "All shared/ writes must be atomic (write to .tmp, then rename)."
19
- exit 2
20
- fi
21
- # Validate JSON structure for specific artifact types
22
- case "$FILE" in
23
- */STATUS.json)
24
- if command -v python3 &> /dev/null; then
25
- python3 -c "import json, sys; json.load(open('$FILE'))" 2>&1
26
- if [ $? -ne 0 ]; then
27
- echo "INVALID: STATUS.json is not valid JSON"
28
- exit 2
29
- fi
30
- fi
31
- ;;
32
- esac
33
- exit 0
34
- ;;
35
- esac
36
-
37
- # Only lint source files (not config, docs, etc.)
38
- case "$FILE" in
39
- *.ts|*.tsx)
40
- if command -v npx &> /dev/null; then
41
- OUTPUT=$(cd "$WORKTREE" && npx eslint "$FILE" --quiet 2>&1)
42
- if [ $? -ne 0 ]; then
43
- echo "Lint failed on ${FILE}:"
44
- echo "$OUTPUT"
45
- echo ""
46
- echo "Fix these lint errors before continuing."
47
- exit 2
48
- fi
49
- fi
50
- ;;
51
- *.rs)
52
- if command -v cargo &> /dev/null; then
53
- OUTPUT=$(cd "$WORKTREE" && cargo clippy --quiet --message-format=short 2>&1 | grep -A5 "$FILE" || true)
54
- if [ -n "$OUTPUT" ]; then
55
- echo "Clippy warnings for ${FILE}:"
56
- echo "$OUTPUT"
57
- echo ""
58
- echo "Fix these warnings before continuing."
59
- # Clippy warnings don't fail the build, but we want clean code
60
- # exit 2 # Uncomment to enforce zero warnings
61
- fi
62
- fi
63
- ;;
64
- *.py)
65
- if command -v ruff &> /dev/null; then
66
- OUTPUT=$(cd "$WORKTREE" && ruff check "$FILE" 2>&1)
67
- if [ $? -ne 0 ]; then
68
- echo "Ruff failed on ${FILE}:"
69
- echo "$OUTPUT"
70
- exit 2
71
- fi
72
- fi
73
- ;;
74
- esac
75
-
76
- exit 0
@@ -1,81 +0,0 @@
1
- #!/bin/bash
2
- # Runs before every Bash tool call
3
- # Blocks dangerous commands and access to other pairs' worktrees
4
- #
5
- # Environment:
6
- # CLAUDE_TOOL_INPUT_COMMAND - the command being executed
7
- # SPRINTLESS_PAIR_ID - the current pair ID
8
-
9
- CMD="${CLAUDE_TOOL_INPUT_COMMAND}"
10
-
11
- # Block direct git push to non-forge branches - must use MCP tools for PR creation
12
- if echo "$CMD" | grep -qE '^git push|^git push '; then
13
- # Allow pushing to the pair's own branch
14
- BRANCH_PATTERN="forge-${SPRINTLESS_PAIR_ID}"
15
- if echo "$CMD" | grep -q "$BRANCH_PATTERN"; then
16
- # Allow pushing own branch
17
- exit 0
18
- fi
19
- echo "BLOCKED: Cannot push to branches other than your own."
20
- echo ""
21
- echo "Your branch: forge-${SPRINTLESS_PAIR_ID}/${SPRINTLESS_TICKET_ID}"
22
- echo ""
23
- echo "After pushing, create a PR using GitHub MCP tools:"
24
- echo " 1. Use create_pull_request from github MCP server"
25
- echo " 2. Write STATUS.json with PR_OPENED status and PR URL"
26
- exit 2
27
- fi
28
-
29
- # Block writes to other pairs' worktrees
30
- if echo "$CMD" | grep -qE 'worktrees/pair-[0-9]+/' ; then
31
- REFERENCED=$(echo "$CMD" | grep -oE 'pair-[0-9]+' | head -1)
32
- if [ "$REFERENCED" != "${SPRINTLESS_PAIR_ID}" ]; then
33
- echo "BLOCKED: Cannot access ${REFERENCED}'s worktree."
34
- echo "You are ${SPRINTLESS_PAIR_ID}."
35
- echo ""
36
- echo "Each pair works in isolation. You cannot read or write"
37
- echo "to another pair's worktree."
38
- exit 2
39
- fi
40
- fi
41
-
42
- # Block writes to main branch
43
- if echo "$CMD" | grep -qE 'checkout main|checkout origin/main'; then
44
- echo "BLOCKED: Cannot checkout main. Work on your branch only."
45
- echo ""
46
- echo "Your branch: forge-${SPRINTLESS_PAIR_ID}/${SPRINTLESS_TICKET_ID}"
47
- exit 2
48
- fi
49
-
50
- # Block dangerous commands
51
- DANGEROUS_PATTERNS="rm -rf /|sudo rm|:(){ :|:& };:|mkfs|dd if="
52
- if echo "$CMD" | grep -qE "$DANGEROUS_PATTERNS"; then
53
- echo "BLOCKED: Dangerous command detected."
54
- echo "This command is not allowed for safety reasons."
55
- exit 2
56
- fi
57
-
58
- # Block network operations (MCP tools should be used instead)
59
- NETWORK_PATTERNS="^curl |^wget |^nc |^ncat |^telnet |^ssh "
60
- if echo "$CMD" | grep -qE "$NETWORK_PATTERNS"; then
61
- echo "BLOCKED: Network commands are not allowed."
62
- echo ""
63
- echo "Use MCP tools instead:"
64
- echo " - For GitHub API: use github MCP server"
65
- echo " - For HTTP requests: use appropriate MCP tool"
66
- exit 2
67
- fi
68
-
69
- # Block package installation (could introduce unreviewed dependencies)
70
- INSTALL_PATTERNS="npm install |yarn add |pip install |cargo install |go get "
71
- if echo "$CMD" | grep -qE "$INSTALL_PATTERNS"; then
72
- echo "BLOCKED: Package installation is not allowed."
73
- echo ""
74
- echo "If a new dependency is needed:"
75
- echo " 1. Document it in PLAN.md"
76
- echo " 2. Get SENTINEL approval"
77
- echo " 3. Have a human add it to package.json/Cargo.toml"
78
- exit 2
79
- fi
80
-
81
- exit 0
@@ -1,28 +0,0 @@
1
- #!/bin/bash
2
- # Runs on PreCompact - converts compaction to clean context reset
3
- # This hook fires when the context window is approaching its limit
4
- #
5
- # Environment:
6
- # SPRINTLESS_SHARED - the shared directory
7
-
8
- SHARED="${SPRINTLESS_SHARED}"
9
-
10
- echo "=============================================="
11
- echo " CONTEXT RESET REQUIRED"
12
- echo "=============================================="
13
- echo ""
14
- echo "Your context window is approaching its limit."
15
- echo "Before this session ends, you must write a handoff."
16
- echo ""
17
- echo "Use the /handoff command now. It will:"
18
- echo " 1. Collect everything needed for the handoff"
19
- echo " 2. Write ${SHARED}/HANDOFF.md"
20
- echo " 3. Update WORKLOG.md with current state"
21
- echo " 4. Exit cleanly"
22
- echo ""
23
- echo "A fresh FORGE session will read your handoff and continue."
24
- echo ""
25
- echo "DO NOT attempt to continue working - write the handoff now."
26
- echo ""
27
-
28
- exit 2
@@ -1,77 +0,0 @@
1
- #!/bin/bash
2
- # Runs before every Write, Edit, MultiEdit tool call
3
- # Enforces dynamic file ownership locking via flock
4
- #
5
- # Environment:
6
- # CLAUDE_TOOL_INPUT_FILE_PATH - the file being written
7
- # SPRINTLESS_PAIR_ID - the current pair ID
8
- # SPRINTLESS_SHARED - the shared directory
9
-
10
- FILE="${CLAUDE_TOOL_INPUT_FILE_PATH}"
11
- PAIR_ID="${SPRINTLESS_PAIR_ID}"
12
- LOCKS_DIR="${SPRINTLESS_SHARED}/../locks"
13
-
14
- # Skip lock check for shared/ artifacts - those are pair-scoped already
15
- case "$FILE" in
16
- */orchestration/pairs/*/shared/*)
17
- exit 0
18
- ;;
19
- esac
20
-
21
- # Also skip if FILE is relative and matches shared pattern
22
- case "$FILE" in
23
- shared/*|./shared/*)
24
- exit 0
25
- ;;
26
- esac
27
-
28
- # Create locks directory if needed
29
- mkdir -p "$LOCKS_DIR" 2>/dev/null
30
-
31
- # Generate lock filename (sha256 hash of filepath to avoid path issues)
32
- LOCK_HASH=$(echo -n "$FILE" | sha256sum | cut -d' ' -f1)
33
- LOCK_FILE="${LOCKS_DIR}/${LOCK_HASH}.lock"
34
- LOCK_JSON="${LOCKS_DIR}/${LOCK_HASH}.json"
35
-
36
- # Attempt atomic lock acquisition using flock
37
- {
38
- # Acquire exclusive lock on .lock file (non-blocking)
39
- flock -x -n 200 || {
40
- echo "BLOCKED: Another process is currently locking ${FILE}"
41
- echo "Waiting for lock to be released..."
42
- exit 2
43
- }
44
-
45
- # Check if lock JSON exists and who owns it
46
- if [ -f "$LOCK_JSON" ]; then
47
- OWNER=$(cat "$LOCK_JSON" | grep -o '"pair"[[:space:]]*:[[:space:]]*"[^"]*"' | head -1 | cut -d'"' -f4)
48
- if [ "$OWNER" != "$PAIR_ID" ]; then
49
- echo "BLOCKED: ${FILE} is currently locked by ${OWNER}."
50
- echo ""
51
- echo "This file is being modified by another pair."
52
- echo ""
53
- echo "Options:"
54
- echo " 1. Find an alternative implementation that avoids this file"
55
- echo " 2. Wait for ${OWNER} to complete and release the lock"
56
- echo " 3. Set STATUS.json to BLOCKED with reason FILE_LOCK_CONFLICT"
57
- echo ""
58
- echo "Lock details in: ${LOCK_JSON}"
59
-
60
- exit 2
61
- fi
62
- # Lock belongs to us - proceed
63
- else
64
- # No lock exists - acquire it
65
- cat > "$LOCK_JSON" << EOF
66
- {
67
- "pair": "${PAIR_ID}",
68
- "file": "${FILE}",
69
- "acquired_at": "$(date -u +%Y-%m-%dT%H:%M:%SZ)"
70
- }
71
- EOF
72
- fi
73
-
74
- } 200>"$LOCK_FILE"
75
-
76
- # Lock acquired or already owned by us - proceed with write
77
- exit 0