So Many Crows v1: Sentry triage, crows, guardrails, trust ledger

Go command-line tool. Sentry classifies each todo item as solo, split,
or murder; text-only crows fly under budget, timeout, and flock caps;
trust is earned per crow and per task type; abusive requesters get a
mild, fading cooldown. Runs offline with a mock brain.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UQnSw4RRWp8uqpj3nsnnXF
This commit is contained in:
SmokeyandClaude Opus 5.5 committed 2026-10-27 08:16:58 -06:00
commit 7ae7f670ff
10 files changed
+999

No files matched your search

+52
View File
@@ -0,0 +1,52 @@
package main
import (
"encoding/json"
"os"
"path/filepath"
"sync"
"time"
)
// Event is one line in the flight log: every triage, flight and verdict.
type Event struct {
Time time.Time `json:"ts"`
Kind string `json:"kind"`
Requester string `json:"requester,omitempty"`
Item string `json:"item,omitempty"`
Crow string `json:"crow,omitempty"`
Mode string `json:"mode,omitempty"`
TaskType string `json:"task_type,omitempty"`
Tokens int `json:"tokens,omitempty"`
Ms int64 `json:"ms,omitempty"`
Verdict string `json:"verdict,omitempty"`
Output string `json:"output,omitempty"`
Error string `json:"error,omitempty"`
Note string `json:"note,omitempty"`
}
type FlightLog struct {
mu sync.Mutex
f *os.File
}
func OpenFlightLog(path string) (*FlightLog, error) {
if err := os.MkdirAll(filepath.Dir(path), 0o755); err != nil {
return nil, err
}
f, err := os.OpenFile(path, os.O_APPEND|os.O_CREATE|os.O_WRONLY, 0o644)
if err != nil {
return nil, err
}
return &FlightLog{f: f}, nil
}
func (l *FlightLog) Write(e Event) {
l.mu.Lock()
defer l.mu.Unlock()
e.Time = time.Now()
b, _ := json.Marshal(e)
l.f.Write(append(b, '\n'))
}
func (l *FlightLog) Close() error { return l.f.Close() }