instruction: Extract user preferences from conversation and save to memory

ilang_request:
[PROTOCOL:I-Lang|v=3.0]
[SCAN:@CONV|whr=preference,habit,decision]
  =>[CLSF|typ=fact,preference,lesson]
  =>[FMT|fmt=ilang]
  =>[WRIT:@LOCAL|path=.ilang/memory.md,mode=append]

ilang_response:
::FACT{id:MEM-001|conf:confirmed|src:conversation}
  User prefers tabs over spaces in all languages
::FACT{id:MEM-002|conf:confirmed|src:conversation}
  User deploys to Cloudflare Workers, not traditional VPS
::PREF{id:MEM-003|conf:confirmed}
  Output format: concise, no verbose explanations
::DECIDED{id:MEM-004|conf:confirmed}
  Database: PostgreSQL over MongoDB for this project
  Reason: transaction requirements


instruction: Build user soul profile from onboarding questions

ilang_request:
[PROTOCOL:I-Lang|v=3.0]
[DRFT:@SOUL|mode=onboarding]
  =>[SCAN:@CONV|whr=identity,role,expertise]
  =>[FMT|fmt=ilang]
  =>[WRIT:@LOCAL|path=.ilang/soul.md]

ilang_response:
::GENE{identity|conf:confirmed|scope:global}
  T:full_stack_developer
  T:startup_founder
  T:ship_first_optimize_later
  A:over_planning⇒waste

::GENE{communication|conf:confirmed}
  T:conclusions_first
  T:code_over_explanation
  T:chinese_for_discussion|english_for_code
  A:walls_of_text⇒rewrite_shorter


instruction: Detect and resolve conflicting memories

ilang_request:
[PROTOCOL:I-Lang|v=3.0]
[READ:@LOCAL|path=.ilang/memory.md]
  =>[SCAN|whr=conflict,contradiction]
  =>[EVAL|sty=conflict_resolution]
  =>[FMT|fmt=ilang]
  =>[WRIT:@LOCAL|path=.ilang/memory.md]

ilang_response:
::CONFLICT{id:CR-001|between:MEM-012,MEM-089}
  MEM-012: User prefers React for all frontend
  MEM-089: User chose Vue for client-X project
  Resolution: React is default preference, Vue exception for client-X
::RESOLVED{id:CR-001|action:keep_both|note:context_dependent}
::MUTATION{id:MEM-012|old:all_frontend|new:default_choice}


instruction: Apply memory decay to outdated entries

ilang_request:
[PROTOCOL:I-Lang|v=3.0]
[READ:@LOCAL|path=.ilang/memory.md]
  =>[FILT|whr=age>90d,conf<0.5]
  =>[EVAL|sty=decay_assessment]
  =>[FMT|fmt=ilang]
  =>[WRIT:@LOCAL|path=.ilang/memory.md]

ilang_response:
::DECAY{id:MEM-034|reason:stale|age:127d}
  Original: User uses Heroku for deployment
  Status: Contradicted by MEM-089 (switched to Cloudflare Workers)
  Action: Archive
::DECAY{id:MEM-041|reason:low_confidence|conf:0.3}
  Original: User might prefer dark mode
  Status: Never confirmed
  Action: Remove


instruction: Generate context briefing for new session

ilang_request:
[PROTOCOL:I-Lang|v=3.0]
[READ:@LOCAL|path=.ilang/soul.md]
  =>[READ:@LOCAL|path=.ilang/memory.md]
  =>[FILT|whr=conf>0.7,relevance=high]
  =>[SHRT|len=500]
  =>[FMT|fmt=ilang]
  =>[OUT]

ilang_response:
::BRIEFING{session:new|timestamp:2026-04-30}
::IDENTITY{role:full_stack_dev|style:ship_first}
::ACTIVE_PROJECT{name:payment-api|stack:Node+PostgreSQL+CF_Workers}
::RECENT_DECISIONS
  D1: JWT auth over session cookies
  D2: Stripe over custom payment
::PREFERENCES
  P1: Concise output, no verbose
  P2: Tabs, not spaces
  P3: TypeScript strict mode
::LESSONS
  L1: Always check CF Worker size limit before deploy
  L2: PostgreSQL JSONB over separate tables for metadata
::END{BRIEFING}

category: briefing


instruction: Migrate memory to a new AI tool

ilang_request:
[PROTOCOL:I-Lang|v=3.0]
[READ:@LOCAL|path=.ilang/soul.md]
  =>[READ:@LOCAL|path=.ilang/memory.md]
  =>[FMT|fmt=ilang]
  =>[OUT|target=new_tool_context]

ilang_response:
::MIGRATION{from:claude_code|to:cursor|timestamp:2026-04-30}
::SOUL_TRANSFER
  ::GENE{identity|conf:confirmed}
    T:full_stack_developer
    T:startup_founder
  ::GENE{coding|conf:confirmed}
    T:typescript_strict
    T:tabs_not_spaces
    T:test_before_commit
::MEMORY_TRANSFER{entries:47|filtered:12_stale}
  ::FACT{database:PostgreSQL|conf:confirmed}
  ::FACT{deploy:cloudflare_workers|conf:confirmed}
  ::DECIDED{auth:JWT|conf:confirmed}
::END{MIGRATION}

category: migration


instruction: Record a lesson learned from debugging session

ilang_request:
[PROTOCOL:I-Lang|v=3.0]
[SCAN:@CONV|whr=lesson,mistake,fix,debug]
  =>[CLSF|typ=lesson]
  =>[FMT|fmt=ilang]
  =>[WRIT:@LOCAL|path=.ilang/memory.md,mode=append]

ilang_response:
::LESSON{id:LSN-023|conf:confirmed|src:debug_session}
  Context: CF Worker returned 524 timeout
  Root cause: Subrequest to external API exceeded 30s limit
  Fix: Add Promise.race with 25s timeout wrapper
  Rule: Always wrap external calls in timeout on edge runtime
::GENE_UPDATE{debugging|mutation:add}
  T:timeout_wrap_external_calls|when:edge_runtime


instruction: Save a critical decision with full context

ilang_request:
[PROTOCOL:I-Lang|v=3.0]
[SCAN:@CONV|whr=decision,chose,decided]
  =>[CLSF|typ=decision]
  =>[FMT|fmt=ilang]
  =>[WRIT:@LOCAL|path=.ilang/memory.md,mode=append]

ilang_response:
::DECIDED{id:DEC-015|conf:confirmed|timestamp:2026-04-30}
  Topic: Authentication strategy
  Choice: JWT with refresh tokens
  Rejected: Session cookies, OAuth-only
  Reasoning: Stateless needed for CF Workers edge deployment
  Tradeoff: Must handle token revocation separately
::FACT{auth_strategy:JWT_refresh|conf:confirmed}


instruction: Check for uncommitted memory changes at session start

ilang_request:
[PROTOCOL:I-Lang|v=3.0]
[SCAN:@LOCAL|path=.ilang/|whr=uncommitted]
  =>[EVAL|sty=dirty_check]
  =>[DECI|if=dirty,then=commit_push]
  =>[OUT]

ilang_response:
::DIRTY_CHECK{path:.ilang/|result:dirty}
::UNCOMMITTED{files:2}
  .ilang/memory.md: 3 new entries since last commit
  .ilang/soul.md: 1 GENE mutation
::ACTION{type:auto_save}
  git add .ilang/
  git commit -m 'auto-save: 3 memories + 1 gene mutation'
  git push
::STATUS{saved:true|entries:4}


instruction: Update behavioral gene based on repeated user correction

ilang_request:
[PROTOCOL:I-Lang|v=3.0]
[SCAN:@CONV|whr=correction,wrong,fix_this]
  =>[EVAL|sty=pattern_detection]
  =>[FMT|fmt=ilang]
  =>[WRIT:@LOCAL|path=.ilang/soul.md,mode=merge]

ilang_response:
::PATTERN_DETECTED{correction_count:3|topic:error_handling}
  Correction 1: 'Stop using try-catch for flow control'
  Correction 2: 'I said no bare catches'
  Correction 3: 'Always use typed errors'
::GENE_MUTATION{gene:coding|type:add}
  T:typed_errors_always|conf:confirmed
  T:no_bare_catch|conf:confirmed
  A:try_catch_flow_control⇒forbidden
::CONFIDENCE{old:0.5|new:1.0|reason:3x_user_correction}