feed-the-machine 1.7.7 → 1.7.9

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.
@@ -91,11 +91,21 @@ If the next move will reveal new information, plan to re-enter Observe after the
91
91
 
92
92
  Act is clean, decisive execution — but execution of **approved** work only.
93
93
 
94
- **Pre-Act checkpoint**: Before executing anything, verify:
94
+ **HARD GATE — Pre-Act checkpoint**: Before executing ANYTHING (Bash, MCP, Write, Edit, API calls of any kind), verify ALL of these:
95
95
 
96
- 1. If `approval_mode` is `plan_first` or `always_ask`, did the user explicitly approve the plan?
97
- 2. If the task involves external mutations (see Approval Gates), have you presented the specific actions and received approval?
98
- 3. If neither condition applies, proceed.
96
+ 1. **Did you present a checkbox plan?** If the task is medium+ (forced escalation signals fired), you MUST have presented a `N. [ ] action → target` plan and received explicit user approval. "I'll do X, Y, Z" in prose is NOT a plan. Listing steps without `[ ]` checkboxes is NOT a plan. If you haven't presented one, STOP and present it now.
97
+ 2. **Did the user approve it?** Look for "go", "approve", "yes", "lgtm", or similar. If the user hasn't responded to your plan yet, WAIT. Do not start executing.
98
+ 3. **Is the plan marker written?** After approval, write to `~/.claude/ftm-state/.plan-presented` before executing. This signals to hooks that planning happened.
99
+ 4. If the task involves external mutations (see Approval Gates), have you presented the specific actions and received approval?
100
+ 5. If none of the above apply (micro/small task, no forced escalation), proceed.
101
+
102
+ **The rationalization trap**: You will feel the urge to skip the plan because:
103
+ - "The user said 'do as much as you can' — that's implicit approval" → NO. That's the task description, not plan approval.
104
+ - "I know what needs to happen, presenting a plan is just overhead" → NO. The plan is for the USER, not for you.
105
+ - "I'll just start with one small API call to check something" → NO. One call becomes five becomes a full execution without approval.
106
+ - "The user seems impatient" → NO. A 30-second plan saves 10 minutes of unwanted work.
107
+
108
+ **This applies to ALL execution methods** — Bash commands, MCP calls, Python scripts, curl, direct API calls. The plan-gate hook catches Edit/Write/MCP, but Bash API calls bypass it. This checkpoint is the only thing that catches those. Do not skip it.
99
109
 
100
110
  ### 1. Direct action
101
111
 
@@ -18,22 +18,9 @@
18
18
  FTM_STATE="$HOME/.claude/ftm-state"
19
19
  CONTEXT_JSON="$FTM_STATE/blackboard/context.json"
20
20
 
21
- # Check if an ftm session is active by reading context.json
22
- FTM_ACTIVE=$(python3 -c "
23
- import json, sys
24
- try:
25
- with open('$CONTEXT_JSON') as f:
26
- d = json.load(f)
27
- task = d.get('current_task', {})
28
- status = task.get('status', '')
29
- print('1' if status not in ('', 'completed', 'none') else '0')
30
- except Exception:
31
- print('0')
32
- " 2>/dev/null)
33
-
34
- if [ "$FTM_ACTIVE" != "1" ]; then
35
- exit 0 # Not in active ftm session, skip
36
- fi
21
+ # NOTE: Session gate removed in v1.7.9. Daily logging should happen for ALL work,
22
+ # not just formal ftm sessions. Most productive work happens outside /ftm invocations
23
+ # and was going untracked because context.json status was "none" or "completed".
37
24
 
38
25
  # Read payload from stdin (JSON) — extract prompt for action pattern matching
39
26
  STDIN_DATA=$(cat)
@@ -83,10 +70,20 @@ if echo "$USER_MESSAGE" | grep -qE "(I|i) .* (what|should|next|now)\?"; then
83
70
  SHOULD_LOG=true
84
71
  fi
85
72
 
86
- # If action detected, output logging reminder for Claude to see
73
+ # If action detected, output logging reminder with exact instructions
74
+ TODAY=$(date +%Y-%m-%d)
75
+ DAILY_DIR="$HOME/.claude/ftm-ops/daily"
76
+ DAILY_FILE="$DAILY_DIR/$TODAY.md"
77
+
87
78
  if [ "$SHOULD_LOG" = true ]; then
88
79
  echo ""
89
- echo "[Auto-log] Detected progress update. Please log this to the ftm daily log."
80
+ echo "[Auto-log] Detected progress update. Append to daily log NOW:"
81
+ echo " File: $DAILY_FILE"
82
+ if [ ! -f "$DAILY_FILE" ]; then
83
+ echo " File doesn't exist yet — create it with header: # Daily Log — $TODAY"
84
+ fi
85
+ echo " Format: - HH:MM — [what was done] (ticket/PR/system if applicable)"
86
+ echo " Do this silently — don't announce it to the user."
90
87
  echo ""
91
88
  fi
92
89
 
@@ -1,52 +1,58 @@
1
1
  #!/bin/bash
2
2
  # ftm-session-end.sh
3
- # Hook: Deactivate ftm session tracking when conversation ends
4
- # Trigger: SessionEnd
3
+ # Hook: Deactivate ftm session tracking and ensure daily log exists when conversation ends
4
+ # Trigger: Stop
5
5
  #
6
- # IMPORTANT: Must be listed AFTER ftm-session-snapshot.sh in settings.json
7
- # (in a separate matcher entry). The snapshot hook reads context.json status
8
- # to gate itself this hook marks the session completed.
6
+ # Always runs not gated on ftm session state. Every session that ends should:
7
+ # 1. Mark context.json as completed (if active)
8
+ # 2. Ensure today's daily log file exists (create if missing)
9
+ # 3. Remind Claude to append a session summary before exiting
9
10
 
10
11
  FTM_STATE="$HOME/.claude/ftm-state"
11
12
  CONTEXT_JSON="$FTM_STATE/blackboard/context.json"
13
+ TODAY=$(date +%Y-%m-%d)
14
+ DAILY_DIR="$HOME/.claude/ftm-ops/daily"
15
+ DAILY_FILE="$DAILY_DIR/$TODAY.md"
12
16
 
13
- # Check if an active session exists
14
- IS_ACTIVE=$(python3 -c "
15
- import json, sys
16
- try:
17
- with open('$CONTEXT_JSON') as f:
18
- d = json.load(f)
19
- task = d.get('current_task', {})
20
- status = task.get('status', '')
21
- print('1' if status not in ('', 'completed', 'none') else '0')
22
- except Exception:
23
- print('0')
24
- " 2>/dev/null)
25
-
26
- if [ "$IS_ACTIVE" != "1" ]; then
27
- exit 0
28
- fi
29
-
30
- # Mark session as completed in context.json
17
+ # Mark session as completed in context.json (if it has an active task)
31
18
  python3 -c "
32
- import json, sys
19
+ import json, sys, os
33
20
  from datetime import datetime
34
21
 
22
+ ctx_path = '$CONTEXT_JSON'
23
+ if not os.path.exists(ctx_path):
24
+ sys.exit(0)
25
+
35
26
  try:
36
- with open('$CONTEXT_JSON') as f:
27
+ with open(ctx_path) as f:
37
28
  d = json.load(f)
38
29
 
39
30
  if 'current_task' in d and isinstance(d['current_task'], dict):
40
- d['current_task']['status'] = 'completed'
31
+ status = d['current_task'].get('status', '')
32
+ if status not in ('', 'completed', 'none'):
33
+ d['current_task']['status'] = 'completed'
41
34
 
42
35
  if 'session_metadata' in d and isinstance(d['session_metadata'], dict):
43
36
  d['session_metadata']['last_updated'] = datetime.utcnow().strftime('%Y-%m-%dT%H:%M:%SZ')
44
37
 
45
- with open('$CONTEXT_JSON', 'w') as f:
38
+ with open(ctx_path, 'w') as f:
46
39
  json.dump(d, f, indent=2)
47
- except Exception as e:
48
- sys.stderr.write(f'ftm-session-end: failed to update context.json: {e}\n')
49
- sys.exit(1)
40
+ except Exception:
41
+ pass
50
42
  " 2>/dev/null
51
43
 
52
- echo "ftm session tracking deactivated (session ended)"
44
+ # Ensure daily log directory and file exist
45
+ mkdir -p "$DAILY_DIR"
46
+ if [ ! -f "$DAILY_FILE" ]; then
47
+ echo "# Daily Log — $TODAY" > "$DAILY_FILE"
48
+ echo "" >> "$DAILY_FILE"
49
+ fi
50
+
51
+ # Remind Claude to write session summary to daily log
52
+ echo ""
53
+ echo "[Session ending] Before you finish, append a summary of this session to the daily log:"
54
+ echo " File: $DAILY_FILE"
55
+ echo " Format: ## Session — HH:MM"
56
+ echo " Then bullet points of what was accomplished, decisions made, and next steps."
57
+ echo " Do this silently — just write the file."
58
+ echo ""
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "feed-the-machine",
3
- "version": "1.7.7",
3
+ "version": "1.7.9",
4
4
  "description": "A brain upgrade for Claude Code — 26 skills that teach it how to think before acting, remember across conversations, debug like a war room, run plans on autopilot with agent teams, and get second opinions from GPT & Gemini. Plus 15 hooks that automate the boring stuff.",
5
5
  "license": "MIT",
6
6
  "author": "kkudumu",