Conversation
Introduces samskaras — small embedded JSON records of significant user
reactions (corrections, approvals, pivots) that are fired back into the
subconscious by cosine similarity on each new turn. Delivers the full
loop end-to-end with Perception extracted from Intuition and wired
alongside samskara firings from day one.
Components:
- AI.Agent.Perception: extracts structured observation (intent,
sentiment, entities, files, actions, holistic observation) from a
turn transcript; replaces the inline perception in Intuition.
- AI.Agent.Intuition: accepts %{perception, samskaras} from the
coordinator; threads firings into drive reactions and synthesis.
- AI.Agent.ReactionClassifier: hot-path classifier that decides
whether a turn warrants a samskara (label + intensity).
- AI.Agent.SamskaraMinter: two-pass extractor (gist/lessons/tags ->
embed -> persist).
- AI.Agent.SamskaraConsolidator: clusters near-duplicates by cosine
similarity and synthesizes impression records.
- Services.SamskaraReactor: per-session GenServer that observes each
user turn and asynchronously drives classifier -> minter under
Services.TaskSupervisor.
- AI.Samskara.Firing: cosine-similarity retrieval over stored records.
- Store.Project.Samskara + Record: per-project JSON file store under
~/.fnord/projects/<name>/samskaras/, alongside conversations.
- AI.Agent.Coordinator.Samskara: bootstrap hook that runs perception,
fires samskaras, observes the turn, and injects a preamble system
message into the coordinator conversation.
- Cmd.Samskara: `fnord samskara status | list | show | fires <query>`.
- fnord index phase "Consolidating samskaras" (consolidator called
from Cmd.Index.index_project as a new phase_results entry).
Also adds AI.Embeddings.cosine_similarity/2, gates tracing behind
FNORD_DEBUG_SAMSKARA, and registers the samskara CLI in Fnord.spec.
- Remove unreachable nested-list flatten in AI.Samskara.Firing.embed
(AI.Embeddings.get/1 only returns flat list(float)).
- Drop unreachable binary/wildcard clauses of perception_text in
AI.Agent.Intuition; spec now matches the state type.
- Drop the dead {:error, _} branch of consolidate_samskaras in
Cmd.Index (SamskaraConsolidator.run/1 never fails today).
Dialyzer infers that clauses 2 and 3 of perception_text completely cover
%AI.Agent.Perception.Result{}, making the empty-struct fallthrough dead.
Per AI.Agent.Perception.Result.t(), raw and observation are always
binaries — so the remaining clauses exhaust the type.
…ails Temporary diagnostic to see the actual warning/error text on the PR page; the grep is case-insensitive and previously only reported a generic failure annotation, leaving the cause behind auth-gated job logs.
Two docs/compile warnings from CI: - 'documentation references type AI.Agent.Perception.Result.t() but the module AI.Agent.Perception.Result is hidden' — drop @moduledoc false and give Result a proper moduledoc so cross-module type refs resolve. - 'a struct for Store.Project.Samskara.Record is expected on struct update' — pattern-match %Record{} in Samskara.mark_consolidated so the compiler sees the struct at the %Record{record | ...} update site.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Introduces samskaras — small embedded JSON records of significant user reactions (corrections, approvals, pivots) that are fired back into the subconscious by cosine similarity on each new turn. Full loop lands here: mint → consolidate → fire → influence, with
Perceptionextracted fromIntuitionand the Intuition/samskara seam wired from day one./root/.claude/plans/alright-let-s-plan-it-sleepy-deer.md(local).samskarais on the workflow's allowlist sorun-tests.ymltriggers on push.Components
AI.Agent.Perception— structured turn perception (intent/sentiment/entities/files/actions/observation); replaces Intuition's inline@perception.AI.Agent.Intuition— now accepts%{perception, samskaras}; threads firings into drive reactions and synthesis.AI.Agent.ReactionClassifier— hot-path classifier (SKIPvsMINT <label> <intensity>).AI.Agent.SamskaraMinter— two-pass: extract gist/lessons/tags → embed → persist.AI.Agent.SamskaraConsolidator— greedy cosine clustering of unconsolidated records into impressions; newfnord indexphase "Consolidating samskaras".Services.SamskaraReactor— GenServer, supervised viastart_config_dependent_services, fans out mint work throughServices.TaskSupervisor.AI.Samskara.Firing+AI.Embeddings.cosine_similarity/2.Store.Project.Samskara+Record— per-project JSON file store under~/.fnord/projects/<name>/samskaras/; dir created byStore.Project.create/1.AI.Agent.Coordinator.Samskara— bootstrap hook: perception → fire → observe turn → inject preamble system message before Intuition.Cmd.Samskara—fnord samskara status | list | show | fires.Knobs
FNORD_DEBUG_SAMSKARA=1— tracing at classifier verdict, minter record, firing top-k, consolidator cluster boundaries.FNORD_SAMSKARA_DISABLED=1— kill switch; reactor becomes a no-op.Test plan
MIX_ENV=test mix compileis clean (blind build; likely the first thing to break).mix testpasses, including newAI.Embeddings.cosine_similarity/2cases.mix dialyzer— specs on new modules compile without warnings.mix docs— no warnings in new module docs.fnord indexshows the new "Consolidating samskaras" phase with zero records.FNORD_DEBUG_SAMSKARA=1 fnord ask "…"— trace shows perception → empty firings → intuition.correction, minter writes a record undersamskaras/.fnord samskara listshows the new record;fnord samskara fires "same topic"returns it with a high cosine score.fnord index→ consolidator collapses them;listshowsconsolidated_intolinks and a new impression.LOGGER_LEVEL=warnwithoutFNORD_DEBUG_SAMSKARA— no debug spam.https://claude.ai/code/session_01SeTUBwDkaXd7e6ppCmzgaJ