* feat(bots): a bot writes first, on the person's own key
A person can tell one of their bots to write first, every day at a time
they pick, with a prompt they wrote. The run happens on the person's own
OpenRouter key only; without a key the routine is kept, shown as waiting,
and skipped with the reason, so no platform key is ever spent by a timer
(fleet standing rule 2026-09-25).
- companion_routines table (one per person per bot, owner-only RLS),
routines-store (time validation, next run in the person's zone) and the
runner behind a cron route + 15-minute systemd timer, registered as a
person-asked timer in the no-background-ai gate with a marker check.
- GET/PUT/DELETE /api/ai-assistants/[id]/routine for the owner.
- RoutineRow in a bot's own chat: "Writes first, every day", time and
prompt inline, a line to Settings when a key is missing.
- Hands: the proposal line names what will be set up, never only "Sure";
a created event's outcome carries its link.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmrXvMqAqZtbpQ4x3et
* feat(bots): a bot can ask Loki, as the person — the first connector
ask_loki: a Cat action (communication, low risk, confirmed) in the hands
launch set. The bot relays a question over the signed OrangeCat → Loki rail
to Loki's POST /api/orangecat/ask, which runs a read-only turn as the Loki
user linked to the actor; Loki's own sentence is the outcome the person
reads, and a refusal (no linked account, a spent budget) is relayed as
written. A relayed question can never dispatch, approve or spend: that stays
with send_task_to_loki, and the two verbs name each other so a question is
never dispatched as a task.
ADR-0013: D6 first connector and D7 recorded as shipped.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmrXvMqAqZtbpQ4x3et
* fix(bots): the routine's day-in-zone comes from the timezone helper
check:app-locale (new on main) refuses a literal locale handed to Intl; the
routine's next-run computation now takes the day in the person's zone from
instantToWallTime, the one rendering the app already trusts.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmrXvMqAqZtbpQ4x3et
* fix(bots): the chip knows the verb of ask_loki
The tool-label table of leading verbs gains ask → Asking / Asked, so the
chip for a bot's question to Loki never falls back to the generic label.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmrXvMqAqZtbpQ4x3et
* fix(cat): a failed "Do it?" card shows the server's sentence, not [object Object]
The confirm and reject hook handed the API's error envelope (an object) to
new Error(), so every failed action read "[object Object]". Seen live the
first time a bot asked Loki for an account not linked to Loki: Loki's
sentence naming the one step was on the action row and lost on the card.
The hook, the memory import and the interests list now read the message
through apiErrorMessage, the reader written for exactly this.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmrXvMqAqZtbpQ4x3et
* fix(companions): a bot keeps offering its hands on a repeat ask
Live on 2026-11-01 the second "Ask Loki" in one thread came back as
"I can ask Loki for you." with no fence and no "Do it?" card. The
proposal fence is taken off a reply before it is stored, so the model
saw its own earlier offers as plain sentences and copied them.
- The queued proposal is kept in the assistant message's metadata.
- The history given to the model writes the fence back onto those
turns (withProposal), so a proposal in the history looks like one.
- proposeFromReply returns the proposal as queued; hands tests cover
the round trip and metadata reading.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmrXvMqAqZtbpQ4x3et
* fix(companions): a proposal is a worked example, and a bare block still becomes a card
Live on 2026-11-01 a fresh bot's first "Ask Loki" came back as "Here's the
query I'll send to Loki:" over a json fence holding {"question": "..."}:
the free-tier model copied the template's inner half and left out the
action, so the person saw code and no card.
- The hands section ends with a complete block for a real offered action,
required fields filled with their own names, instead of a template with
<id> and {...}; it says the block is the proposal itself and to write no
other code block.
- extractProposal reads a propose, json or untagged fence at the end; a
block with fields but no "action" names the one offered action that owns
every field and has its required ones present; a propose fence that said
nothing usable comes off so it is never shown as code.
- Tests for the example, the lenient read, the inference and its refusals.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmrXvMqAqZtbpQ4x3et
* fix(bots): a failed "Do it?" card is finished, a second card starts clean, no empty bubble
Seen live on 2026-11-01 (fresh thread, two asks of Loki):
- a card whose action ran and failed kept Confirm/Reject under the reason;
the reason is now the outcome line, as a success would be
- the second card in the thread showed the first card's failure line inside
it: the card is keyed by its action
- a model that wrote only the block left an empty bubble above the card:
the card's description stands in for the words, and ask_loki is described
as the question ("Ask Loki: ...") rather than "Execute Ask Loki"
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmrXvMqAqZtbpQ4x3et
* test(bots): the five demos as one live rehearsal, run by a person
tests/e2e/bots-rehearsal.live.spec.ts walks the live site as a brand-new
person (a pseudonymous account minted at the start, no fixture secret): one
door, the shelf and a real letter, a group with two specialists in their
lanes, an event proposed and created from a "Do it?" card, Loki asked twice
with an honest outcome and a clean second card, a routine set and stopped,
and the API edges. Every assertion names the value it protects.
The Live rehearsal workflow runs it on workflow_dispatch only and keeps the
screenshots; it has no schedule, because a free-tier key is spent only when
a person asks (fleet rule 2026-09-25). docs/testing/live-rehearsal.md.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmrXvMqAqZtbpQ4x3et
* feat(bots): what a bot did stays in the thread
A "Do it?" card's outcome lived only in the slot above the composer: it left
the screen when a second card arrived and was gone on reload (seen live
2026-11-01). The confirm route now records the outcome as a line of the bot
conversation the card came from (services/companions/outcomes.ts): the
handler's own sentence with its page, or the reason it failed. The chat
re-reads the thread after the tap, so the line shows where it was asked
for, and the bot's next turn knows what happened.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmrXvMqAqZtbpQ4x3et
* test(bots): the rehearsal retries a gateway error once
Seen 2026-11-01 at 16:50Z: the first post-deploy rehearsal passed six of
seven and failed the routine step on one PUT that answered 502, because
another merge (#1515) was rolling out at that second; the same call
answered 400 a minute later. An API call in the rehearsal now retries once
after five seconds on 502/503/504 and logs that it did; two in a row stay a
failure. Documented in docs/testing/live-rehearsal.md.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmrXvMqAqZtbpQ4x3et
---------
Co-authored-by: Claude <noreply@anthropic.com>
* feat(bots): a bot writes first, on the person's own key
A person can tell one of their bots to write first, every day at a time
they pick, with a prompt they wrote. The run happens on the person's own
OpenRouter key only; without a key the routine is kept, shown as waiting,
and skipped with the reason, so no platform key is ever spent by a timer
(fleet standing rule 2026-09-25).
- companion_routines table (one per person per bot, owner-only RLS),
routines-store (time validation, next run in the person's zone) and the
runner behind a cron route + 15-minute systemd timer, registered as a
person-asked timer in the no-background-ai gate with a marker check.
- GET/PUT/DELETE /api/ai-assistants/[id]/routine for the owner.
- RoutineRow in a bot's own chat: "Writes first, every day", time and
prompt inline, a line to Settings when a key is missing.
- Hands: the proposal line names what will be set up, never only "Sure";
a created event's outcome carries its link.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmrXvMqAqZtbpQ4x3et
* feat(bots): a bot can ask Loki, as the person — the first connector
ask_loki: a Cat action (communication, low risk, confirmed) in the hands
launch set. The bot relays a question over the signed OrangeCat → Loki rail
to Loki's POST /api/orangecat/ask, which runs a read-only turn as the Loki
user linked to the actor; Loki's own sentence is the outcome the person
reads, and a refusal (no linked account, a spent budget) is relayed as
written. A relayed question can never dispatch, approve or spend: that stays
with send_task_to_loki, and the two verbs name each other so a question is
never dispatched as a task.
ADR-0013: D6 first connector and D7 recorded as shipped.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmrXvMqAqZtbpQ4x3et
* fix(bots): the routine's day-in-zone comes from the timezone helper
check:app-locale (new on main) refuses a literal locale handed to Intl; the
routine's next-run computation now takes the day in the person's zone from
instantToWallTime, the one rendering the app already trusts.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmrXvMqAqZtbpQ4x3et
* fix(bots): the chip knows the verb of ask_loki
The tool-label table of leading verbs gains ask → Asking / Asked, so the
chip for a bot's question to Loki never falls back to the generic label.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmrXvMqAqZtbpQ4x3et
* fix(cat): a failed "Do it?" card shows the server's sentence, not [object Object]
The confirm and reject hook handed the API's error envelope (an object) to
new Error(), so every failed action read "[object Object]". Seen live the
first time a bot asked Loki for an account not linked to Loki: Loki's
sentence naming the one step was on the action row and lost on the card.
The hook, the memory import and the interests list now read the message
through apiErrorMessage, the reader written for exactly this.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmrXvMqAqZtbpQ4x3et
* fix(companions): a bot keeps offering its hands on a repeat ask
Live on 2026-11-01 the second "Ask Loki" in one thread came back as
"I can ask Loki for you." with no fence and no "Do it?" card. The
proposal fence is taken off a reply before it is stored, so the model
saw its own earlier offers as plain sentences and copied them.
- The queued proposal is kept in the assistant message's metadata.
- The history given to the model writes the fence back onto those
turns (withProposal), so a proposal in the history looks like one.
- proposeFromReply returns the proposal as queued; hands tests cover
the round trip and metadata reading.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmrXvMqAqZtbpQ4x3et
* fix(companions): a proposal is a worked example, and a bare block still becomes a card
Live on 2026-11-01 a fresh bot's first "Ask Loki" came back as "Here's the
query I'll send to Loki:" over a json fence holding {"question": "..."}:
the free-tier model copied the template's inner half and left out the
action, so the person saw code and no card.
- The hands section ends with a complete block for a real offered action,
required fields filled with their own names, instead of a template with
<id> and {...}; it says the block is the proposal itself and to write no
other code block.
- extractProposal reads a propose, json or untagged fence at the end; a
block with fields but no "action" names the one offered action that owns
every field and has its required ones present; a propose fence that said
nothing usable comes off so it is never shown as code.
- Tests for the example, the lenient read, the inference and its refusals.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmrXvMqAqZtbpQ4x3et
* fix(bots): a failed "Do it?" card is finished, a second card starts clean, no empty bubble
Seen live on 2026-11-01 (fresh thread, two asks of Loki):
- a card whose action ran and failed kept Confirm/Reject under the reason;
the reason is now the outcome line, as a success would be
- the second card in the thread showed the first card's failure line inside
it: the card is keyed by its action
- a model that wrote only the block left an empty bubble above the card:
the card's description stands in for the words, and ask_loki is described
as the question ("Ask Loki: ...") rather than "Execute Ask Loki"
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmrXvMqAqZtbpQ4x3et
* test(bots): the five demos as one live rehearsal, run by a person
tests/e2e/bots-rehearsal.live.spec.ts walks the live site as a brand-new
person (a pseudonymous account minted at the start, no fixture secret): one
door, the shelf and a real letter, a group with two specialists in their
lanes, an event proposed and created from a "Do it?" card, Loki asked twice
with an honest outcome and a clean second card, a routine set and stopped,
and the API edges. Every assertion names the value it protects.
The Live rehearsal workflow runs it on workflow_dispatch only and keeps the
screenshots; it has no schedule, because a free-tier key is spent only when
a person asks (fleet rule 2026-09-25). docs/testing/live-rehearsal.md.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmrXvMqAqZtbpQ4x3et
* feat(bots): what a bot did stays in the thread
A "Do it?" card's outcome lived only in the slot above the composer: it left
the screen when a second card arrived and was gone on reload (seen live
2026-11-01). The confirm route now records the outcome as a line of the bot
conversation the card came from (services/companions/outcomes.ts): the
handler's own sentence with its page, or the reason it failed. The chat
re-reads the thread after the tap, so the line shows where it was asked
for, and the bot's next turn knows what happened.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019MDtmrXvMqAqZtbpQ4x3et
---------
Co-authored-by: Claude <noreply@anthropic.com>
Forty-five 2025 plans, assessments, design scenarios, status reports and
superseded business docs move to docs/archive/ (same relative path). Each
described a plan or a snapshot as if it were the running system: strict:false,
a five-table schema, an "organization" entity, price_sats, a Gemini /api/chat
widget, a /auth/forgot-password page, Google Places, building group labels and
contract voting flows that never landed.
Fixed in place: NAVIGATION_UX_DESIGN.md (referenced by .claude/rules) gains a
status note naming what shipped and where; GENERIC_API_HANDLERS.md lists the
handler options the code actually takes; datetime_standards.md points at
scripts/dev/; CONTRIBUTING.md describes the auto-merge shipping flow. Inbound
links repointed (SECURITY.md at the root, SUPABASE_SCHEMA_GUIDE.md for schema).
Claude-Session: https://claude.ai/code/session_01PJkbo18cRNXtgPWZN2S9cD
Co-authored-by: Claude <noreply@anthropic.com>
* docs: archive point-in-time records, drop broken guide symlinks
Status reports, progress trackers, audits, session summaries, completed
migration plans and the 2025 roadmap move to docs/archive/ (same relative
path), with a README saying they describe the day they were written.
.ai-guides/ held only symlinks into a docs/guides/ai/ that no longer
exists, tests/unit/docs/ held a stray copy of an old getting-started page,
and docs/operations/PORT_MANAGEMENT_README.md duplicated port-management.md;
all three are deleted.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PJkbo18cRNXtgPWZN2S9cD
* docs: correct drifted paths, links and versions in current docs
Fix in place the reference docs agents use: point paths at where the code
lives now (src/stores/auth.ts, src/lib/supabase/*, scripts/dev/*,
docs/reference/api/CONVENTIONS.md, the squashed baseline migration),
rewrite the development, features, operations and API index pages to list
documents that exist, say plainly where something is gone (/api/metrics,
the CSP report route, .envrc in the repo, Loki's `migrate` script), and
correct the Next.js major. docs-truth findings: 468 -> 2 (both "Next 30/90
Days" headings in the legal overview, a checker false positive).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PJkbo18cRNXtgPWZN2S9cD
---------
Co-authored-by: Claude <noreply@anthropic.com>
Remove the active-step credentials source pin; resolveProvider's return
shape is the contract, covered by the BYOK fetch behaviour tests.
Co-authored-by: Cursor <cursoragent@cursor.com>
Merge forget-generic-stem-innocents into memory-forget. Compress
hasRichContext to two cases. Drop failure-alert orchestrator source-grep.
Co-authored-by: Cursor <cursoragent@cursor.com>
Delete routing-thin-input, actions-via-wiring, model-display-name, and
quota-helpers (theatre / cosmetic). Fold tool-definitions dedupe into
action-schemas. Drop proactivity prompt-prose pins; keep the switch.
Leave forget-failure intact — SELECT-fail honesty is not in memory-forget.
Co-authored-by: Cursor <cursoragent@cursor.com>
Replace the 1650-line action-executor column encyclopedia with eleven
table-driven cases that pin the April 2026 wrong-column class of bug.
Drop prompt-context byte snapshots. Rewrite testing docs to reject
coverage-percentage goals and point at verify as the real gate.
Co-authored-by: Cursor <cursoragent@cursor.com>
The sibling product was renamed on 2026-09-14. Every reference follows:
service and route paths (src/services/loki, /api/integrations/loki),
env keys (LOKI_*), the build-intent audience and timeline source ('loki'),
ecosystem config, docs, tests, and 13 file names.
Tool labels keep "Loki" capitalised: the old name had an internal capital
and passed the "looks like a name" shape test for free; a one-word name
needs listing, so softLower now carries a small PROPER_NOUNS set.
Box and data were moved ahead of this: LOKI_* keys sit beside the old ones
in the app env, the OAuth client is `loki` with the new callback host, and
timeline/metadata rows carrying the old name were rewritten.
Claude-Session: https://claude.ai/code/session_016YJVAanfj8keVSXyZnTemh
Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
Grip-handle drag tested live: platform default dragged to bottom (→pos 2) and
back to top (→pos 0), both persisted via PATCH — same path as arrow controls.
Removes the earlier "not covered" caveat. Also confirmed light-mode renders
correctly post semantic-migration.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Production verification notes for the repositionable platform-default in the
Cat multi-key fallback chain: anon-session + DB-seeded dummy keys, reorder via
arrow controls, persistence confirmed in the shared sort_order /
platform_chain_position index space. Cleanup documented. Native drag noted as
not covered (Playwright synthetic-event limitation; same code path as arrows).
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The docs tree had sprawled into ~40 overlapping/singleton/empty directories.
Consolidated (history preserved via git rename detection; links rewritten so
no previously-working link broke):
- architecture/ ← adr/, database/, + loose *_ARCHITECTURE / my-cat specs
- development/ ← standards, contributing, guides, examples, templates, components, ai
- operations/ ← devops (+runbooks), deployment, supabase
- design-system/← design, UX, ux-improvements, branding
- reference/ ← api, changelog, content, misc
- forward-looking/ ← planning, improvements, implementation
- archive/2026-h1/ ← point-in-time reports/plans that were loose at docs/ root
- removed empty docs/analysis/; rewrote docs/README.md as a current index
Verified: non-README relative-link health 81→83 OK (0 regressions, same 64
pre-existing-rot broken); all new README links resolve; external refs in
.claude/ + root repointed to moved targets.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Snapshot-style markdown was multiplying — multiple AUDIT_REPORT.md
variants, ENTITY_*_FIXES.md fork trees, RLS-fix instruction docs from
old migrations, *_COMPLETE.md / *_SUMMARY.md from work that's been
shipped for months. They were authoritative once; today they're
landmines for anyone running `grep` to find the current SSOT.
Moved everything that matches AUDIT|EVAL|REPORT|PROPOSAL|PLAN|FIX|
HANDOFF|IMPROVEMENT|SUMMARY|FINDING|COMPLETE|ANALYSIS in
docs/{,development/,analysis/,testing/} into docs/archive/2026-h1/.
99 files. Preserved via git mv so history is intact; no content lost.
Refreshed docs/AUDIT_REPORT.md as the single current state-of-the-
platform doc — it now (a) lists every commit this session shipped,
(b) names the active SSOT files, (c) prioritises remaining gaps as
P0/P1/P2/P3, (d) lists the production credentials / deploy steps that
need human hands. Marked it as the file that supersedes all the
archived ones.
Marked the ModernChatPanel.tsx re-export shim removal in
docs/architecture/CAT_AND_DESIGN_SSOT.md §5 P2 #7 — shim deleted, one
importer in dashboard/cat/page.tsx updated to point at
./ModernChatPanel/index directly. tsc + lint clean.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
- Fixed ESLint config to properly include TypeScript ESLint plugin
- Updated all test files to use new field names (fixed_price, hourly_rate instead of *_sats)
- Updated tests to use PLATFORM_DEFAULT_CURRENCY instead of hardcoded 'SATS'
- Fixed mock exports to include apiValidationError
- Fix currency defaults (SATS → CHF) across forms, configs, and API routes
- Remove @ts-nocheck from socialService.ts and improve type safety
- Replace console.log statements with proper logger utility in production code
- Additional type safety improvements and code quality enhancements
- Documentation updates for improved maintainability
All changes follow DRY, SSOT, and separation of concerns principles.
- Fixed messaging service Supabase insert/update type errors
- Fixed profile hooks (useProfileForm, useAuth, useActiveRoute, useMobileMenu)
- Added missing type exports (UserProduct, UserService, UserCause, Profile with email)
- Fixed messaging API route type errors
- Updated Database types for proper Supabase type safety
Note: Some TypeScript errors remain in non-critical areas (commerce, entity configs, tests) but core messaging and profile functionality is type-safe.
- Replace console.error with structured logging using logger utility
- Extract duplicate error handling into centralized utilities
- Add constants for magic numbers and timeouts
- Improve type safety by eliminating any types and adding proper interfaces
- Standardize error response format across all wallet API endpoints
- Fix timeout cleanup issues and memory leaks
- Add comprehensive error handling for wallet operations
- Add public profile route at /profiles/[username] with server-side rendering
- Convert project pages to Server Components with generateMetadata for SEO
- Add Open Graph and Twitter Card metadata for social media previews
- Fix middleware to allow public access to /profiles/ and /projects/ routes
- Add PublicProfileClient and ProjectPageClient components for interactivity
- Update route constants with PROFILES.VIEW(username) for public profiles
- Add 404 pages for profiles and projects
- Deprecate SocialMetaTags component (replaced with generateMetadata API)
- Fix database field name mapping (name vs display_name)
- Add comprehensive testing scripts and documentation
- Fix missing Link import in UnifiedHeader
This enables users to share their profiles and projects on social media
with proper preview cards (no more 'Loading...' on Twitter/Facebook).
Phase 1 complete - ready for production deployment.
- Bump version to 0.1.1 for tracking
- Add webpack-bundle-optimizer script for Next.js config
- Simplify ESLint configuration to resolve missing dependencies
- Prepare for production deployment with proper version control
This deployment includes:
- Profile update fixes with banner_url support
- LN address validation
- Auth cookie fixes for profile updates
- Various documentation and testing improvements
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>