Burnmydays commited on
Commit ·
d5a6fc2
1
Parent(s): bbc473c
update
Browse files- claudetodolist.md +147 -0
claudetodolist.md
ADDED
|
@@ -0,0 +1,147 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
2 items... i had devin build the instructions for the following...
|
| 2 |
+
|
| 3 |
+
|
| 4 |
+
1) i dont feel like we covered enough on instructions and detailing what information we need, where to get it... and where to imput it
|
| 5 |
+
|
| 6 |
+
|
| 7 |
+
|
| 8 |
+
2) # Supabase Migration — SigRank Importer Overhaul
|
| 9 |
+
|
| 10 |
+
Run these in the Supabase SQL Editor (Dashboard → SQL Editor → New Query).
|
| 11 |
+
|
| 12 |
+
---
|
| 13 |
+
|
| 14 |
+
## 1. Add columns to `sigrank_operators`
|
| 15 |
+
|
| 16 |
+
```sql
|
| 17 |
+
-- Timestamp for when the entry was last submitted/updated
|
| 18 |
+
ALTER TABLE sigrank_operators
|
| 19 |
+
ADD COLUMN IF NOT EXISTS submitted_at TIMESTAMPTZ DEFAULT now();
|
| 20 |
+
|
| 21 |
+
-- HuggingFace username — only authenticated users can persist
|
| 22 |
+
ALTER TABLE sigrank_operators
|
| 23 |
+
ADD COLUMN IF NOT EXISTS hf_user TEXT;
|
| 24 |
+
|
| 25 |
+
-- Index for fast lookups by HF user
|
| 26 |
+
CREATE INDEX IF NOT EXISTS idx_sigrank_operators_hf_user
|
| 27 |
+
ON sigrank_operators (hf_user);
|
| 28 |
+
```
|
| 29 |
+
|
| 30 |
+
---
|
| 31 |
+
|
| 32 |
+
## 2. Create `sigrank_sessions` table (session history / Greatest Hits)
|
| 33 |
+
|
| 34 |
+
```sql
|
| 35 |
+
CREATE TABLE IF NOT EXISTS sigrank_sessions (
|
| 36 |
+
id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY,
|
| 37 |
+
name TEXT NOT NULL,
|
| 38 |
+
input BIGINT NOT NULL DEFAULT 0,
|
| 39 |
+
output BIGINT NOT NULL DEFAULT 0,
|
| 40 |
+
cache_create BIGINT NOT NULL DEFAULT 0,
|
| 41 |
+
cache_read BIGINT NOT NULL DEFAULT 0,
|
| 42 |
+
cost_usd DOUBLE PRECISION,
|
| 43 |
+
source TEXT DEFAULT 'manual',
|
| 44 |
+
estimated BOOLEAN DEFAULT FALSE,
|
| 45 |
+
caveat TEXT,
|
| 46 |
+
hf_user TEXT,
|
| 47 |
+
submitted_at TIMESTAMPTZ DEFAULT now()
|
| 48 |
+
);
|
| 49 |
+
|
| 50 |
+
-- Index for loading a user's session history
|
| 51 |
+
CREATE INDEX IF NOT EXISTS idx_sigrank_sessions_name
|
| 52 |
+
ON sigrank_sessions (name, submitted_at DESC);
|
| 53 |
+
```
|
| 54 |
+
|
| 55 |
+
---
|
| 56 |
+
|
| 57 |
+
## 3. RLS policies (keep anon read-only, service key for writes)
|
| 58 |
+
|
| 59 |
+
```sql
|
| 60 |
+
-- Enable RLS on the new table
|
| 61 |
+
ALTER TABLE sigrank_sessions ENABLE ROW LEVEL SECURITY;
|
| 62 |
+
|
| 63 |
+
-- Anon can read session history
|
| 64 |
+
CREATE POLICY "anon_read_sessions" ON sigrank_sessions
|
| 65 |
+
FOR SELECT USING (true);
|
| 66 |
+
|
| 67 |
+
-- Service role can insert (writes come from the app backend)
|
| 68 |
+
CREATE POLICY "service_insert_sessions" ON sigrank_sessions
|
| 69 |
+
FOR INSERT WITH CHECK (true);
|
| 70 |
+
|
| 71 |
+
-- Same pattern for the new columns on sigrank_operators
|
| 72 |
+
-- (existing policies should already cover SELECT/INSERT;
|
| 73 |
+
-- verify the existing INSERT policy allows the new columns)
|
| 74 |
+
```
|
| 75 |
+
|
| 76 |
+
---
|
| 77 |
+
|
| 78 |
+
## 4. Verify
|
| 79 |
+
|
| 80 |
+
After running the above, check:
|
| 81 |
+
|
| 82 |
+
```sql
|
| 83 |
+
-- Should show submitted_at and hf_user columns
|
| 84 |
+
SELECT column_name, data_type
|
| 85 |
+
FROM information_schema.columns
|
| 86 |
+
WHERE table_name = 'sigrank_operators'
|
| 87 |
+
ORDER BY ordinal_position;
|
| 88 |
+
|
| 89 |
+
-- Should exist with all columns
|
| 90 |
+
SELECT column_name, data_type
|
| 91 |
+
FROM information_schema.columns
|
| 92 |
+
WHERE table_name = 'sigrank_sessions'
|
| 93 |
+
ORDER BY ordinal_position;
|
| 94 |
+
```
|
| 95 |
+
|
| 96 |
+
---
|
| 97 |
+
|
| 98 |
+
## Notes
|
| 99 |
+
|
| 100 |
+
- `sigrank_operators` still upserts on `name` (one board entry per operator)
|
| 101 |
+
- `sigrank_sessions` is append-only — every submission creates a new row
|
| 102 |
+
- The app reads sessions via `load_session_history(name, limit=5)` for the Greatest Hits display
|
| 103 |
+
- `hf_user` is populated only when the user is authenticated via HuggingFace OAuth on the Space
|
| 104 |
+
- Without the `SUPABASE_SERVICE_KEY` env var, all writes are no-ops (safe for public demo)
|
| 105 |
+
|
| 106 |
+
|
| 107 |
+
|
| 108 |
+
3)Here's the spec for ./sigrank --all that Claude Code can implement:
|
| 109 |
+
Goal: ./sigrank --all runs each ccusage provider sequentially and loads results into the user's profile one at a time.
|
| 110 |
+
In sigrank.py:
|
| 111 |
+
|
| 112 |
+
# Add to argparser:
|
| 113 |
+
p.add_argument("--all", action="store_true",
|
| 114 |
+
help="run all providers (claude + codex) sequentially")
|
| 115 |
+
|
| 116 |
+
# In main(), before the existing try block:
|
| 117 |
+
if args.all:
|
| 118 |
+
for provider, is_codex in [("claude", False), ("codex", True)]:
|
| 119 |
+
sub_args = type("a", (), {
|
| 120 |
+
"file": None, "stdin": False, "codex": is_codex,
|
| 121 |
+
"name": args.name, "no_color": args.no_color,
|
| 122 |
+
"stdin_dash": None
|
| 123 |
+
})()
|
| 124 |
+
try:
|
| 125 |
+
raw, how = _grab_usage(sub_args)
|
| 126 |
+
# Build operator_profile from Claude data if running Codex
|
| 127 |
+
op_profile = None
|
| 128 |
+
if is_codex:
|
| 129 |
+
# Try to get Claude's I/O ratio for Beta pathway
|
| 130 |
+
try:
|
| 131 |
+
claude_args = type("a", (), {"file": None, "stdin": False, "codex": False})()
|
| 132 |
+
c_raw, _ = _grab_usage(claude_args)
|
| 133 |
+
ci, co, _, _, _ = parse_ccusage(c_raw)
|
| 134 |
+
if co > 0:
|
| 135 |
+
op_profile = {"model_type": "claude", "io_ratio": ci / co}
|
| 136 |
+
except Exception:
|
| 137 |
+
pass
|
| 138 |
+
i, o, cw, cr, meta = ingest_meta(raw, operator_profile=op_profile)
|
| 139 |
+
m = compute(i, o, cw, cr, cost_usd=meta.get("cost"))
|
| 140 |
+
if meta.get("estimated"):
|
| 141 |
+
m["_caveat"] = meta.get("caveat")
|
| 142 |
+
print(render(args.name, m, how, color=not args.no_color))
|
| 143 |
+
except Exception as e:
|
| 144 |
+
print(f" [{provider}] skipped: {e}")
|
| 145 |
+
sys.exit(0)
|
| 146 |
+
Flow: ./sigrank --all → runs ccusage claude --json, prints profile → runs ccusage codex --json, prints profile with Alpha or Beta pathway applied. Each provider is independent — if one fails, the other still runs. find the users model via ccusage --help
|
| 147 |
+
That should be everything! PRs #5 and #6 cover the full importer overhaul. Let me know if you need anything else.
|