The KAGAMI mark КАГАМИ
kagami.bg/academy · lesson · machine-readable viewVERIFIED 2026-10-01 · UPDATED 2026-10-01
IDENTITY
module
DevStation 06 · AI decision clone: consent-first framework
series
DevStation · lesson 6 of 6 (final)
level
Advanced
duration
1–2 h (estimate)
prerequisites
DevStation lessons 1–5: a local model runtime, a workflow engine and a vector database, all running on your own machine; optionally OpenClaw (lesson 3) as a chat channel. Note: OpenClaw is a Gateway-based personal assistant, NOT an Open WebUI style chat page
trust_label
VERIFIED 2026-10-01 · UPDATED 2026-10-01 (not TESTED: the full pipeline was not run against a live model; only the chunking code was executed)
next
DevStation overview (course map)
PURPOSE

Encode one person's decision criteria (a partner-risk matrix, a six-perspective analysis, a company-research routine) into a local language model with a system prompt and a document memory (RAG), so it can advise — never decide. The lesson puts consent and transparency first: clone only yourself, or another person only with written consent; tell everyone who talks to the assistant that it is AI; keep a human as the decision maker. Voice and face cloning are out of scope.

KEY CONCEPTS
COMMANDS / PATHS
CHECKLIST
NEXT MODULE

DevStation overview (course map) · offer: Quick experiment (kagami.bg/stalbata/)

SOURCES
TAGS
ai-cloneconsentai-act-art-50gdprollamamodelfileragqdrantn8ndecision-support
VERIFIED · 01.10.2026 UPDATED · 01.10.2026

The AI decision clone: consent first, labelled as AI

We build a local assistant that knows your decision criteria: which partner is a good one, when a full analysis is needed, how to check a new company. The assistant advises, it does not decide. And it is the "clone" of you, or of a person who has given you written consent. Never a secret one of somebody else.

⏱ 1–2 h Advanced DevStation · Lesson 6/6 decisions · consent · RAG
Ollama + Qwen2.5 (7b / 14b)🔒 local nomic-embed-text (embeddings)🔒 local Qdrant (document memory)🔒 local n8n (workflows)🔒 local Web search for reputation🌐 global
🔄
UPDATED · 01.10.2026 — what changed
The lesson is rewritten with consent first. Before the steps there is a new part on whom you may "clone" and how, what Article 50 of the AI Act requires (applies from 02.08.2026) and when data becomes biometric under the GDPR. The code is fixed too: Ollama's old /api/embeddings is replaced by /api/embed; in Qdrant, search goes through the Query API and writes use unique, valid ids (the old example overwrote the previous document's points and sent text as an id); instead of Google's Custom Search API, which is closing, a generic search is described; thresholds are in EUR, not BGN; "rating the owners" is replaced with rating their visible behaviour. Unsupported claims and the static "Version 1.0 · 2024" line are removed.
Not verified live (hence no TESTED label): the whole pipeline was not run against a live Ollama/n8n/Qdrant; only the text-chunking code was executed.

01What you'll learn

02Before you start

⛔
Rule no. 1: you clone only yourself, or with written consent
The assistant will speak "in your voice" in text. If you name it after a colleague, partner or client and feed it their letters, recordings or opinions, you are building their likeness without them. Without written consent you don't. Consent outranks every technical possibility.

03Steps

  1. What the decision clone is

    It is not a chatbot that "pretends to be you". It is a model you have given your principles, criteria and memory so that it helps you think more consistently. Why it helps: when criteria are written down, you apply them the same way on a good day and a bad one.

    What you use it forHow it works
    Decision-makingBefore each big decision the partner matrix and the six hats are applied.
    Company checkYou give a company ID or name; the assistant collects structured first-look data from public sources.
    Document analysisYou upload a contract or quote; the assistant reads it with your framework and makes a recommendation.
    Consistent styleIt answers by your rules. To outsiders, always with a sign that it is AI.
    ⚠️
    The clone is not you
    The model has none of your responsibility and does not know the context you haven't given it. So the system prompt has a hard rule: it analyses and recommends; it doesn't decide and doesn't commit anyone.
  2. Consent, transparency and data

    This is the step most courses skip. It comes before any code, because it determines what you are allowed to build in. The table is below; full texts of the articles are in Sources.

    SituationWhat you doBasis
    The clone is yoursWrite down the purpose, what data it uses and where it lives. Data stays local.good practice
    The clone is of another personOnly with written consent: what for, what data, where it is kept, until when, how it is withdrawn. No consent, no clone.good practice; for personal data, the GDPR
    The assistant talks to peopleTell them they are talking to AI, at the latest at the first contact (unless obvious).AI Act, Art. 50(1) and (5) · applies from 02.08.2026
    You generate an image, voice or video of a real person that looks genuineDisclose that it is artificially generated. Not part of this lesson.AI Act, Art. 50(4)
    Voice or face dataBiometric data processed to uniquely identify a person is prohibited unless an Art. 9(2) condition applies (e.g. explicit consent). Whether your case falls here: ask a lawyer or the data protection authority.GDPR, Art. 9(1) and 9(2)(a)
    A portrait or photo of another personAs a rule the consent of the person depicted is needed, with exceptions (public activity, public place, a detail in a gathering). ⚠️ The full text is not quoted: check Art. 13 of the Bulgarian Copyright and Related Rights Act in the State Gazette.Bulgarian Copyright Act, Art. 13 ⚠️
    Checking a company with names of owners and managersThese are personal data: collect the minimum, keep a retention period, rate visible behaviour, not the person.GDPR
    A decision that affects a personDon't leave the decision to automated processing alone. The assistant recommends; a human decides.GDPR, Art. 22(1)
    📅
    The dates that matter (checked as of 01.10.2026)
    Art. 50 of the AI Act applies from 02.08.2026. Regulation (EU) 2026/1744 (the "Digital Omnibus on AI", in force since 27.07.2026) deferred the high-risk regime but does not touch Art. 50. The only grace period runs to December 2026 for the machine-readable marking under Art. 50(2) of generative systems placed on the market before 02.08.2026. Fines for Art. 50 go up to EUR 15 million or 3% of worldwide turnover; for SMEs the lower of the two applies. Duties are split by role: the provider of the system (paras 1 and 2) and the deployer who uses it (para 4) — you may be both.

    Here is a short consent sample. Copy it, fill it in and keep it signed. It is good practice, not a legal template: for real use, have a lawyer review it.

    text · consent for an AI assistant (sample)
    CONSENT TO CREATE AN AI ASSISTANT BASED ON MY MATERIALS
    
    I, <name>, consent to <organisation/person> creating an AI assistant
    that reflects my criteria and style for making decisions.
    
    1. Purpose: <what the assistant will be used for>
    2. Data: <which of my texts/documents are used> (no voice recordings, no photos)
    3. Where kept: only on devices controlled by <organisation/person>
    4. Period: until <date>, after which the data is deleted
    5. Labelling: every conversation shows that the assistant is AI, not me
    6. Withdrawal: I can withdraw consent at any time in writing;
       the assistant is switched off and the data deleted within <number> days
    
    Date: ________   Signature: ________________
  3. The partner matrix after Cipolla

    In an essay on human stupidity, Carlo Cipolla describes four types of people by what they themselves gain or lose and what others gain or lose. In the lesson we use them to assess a partnership: every decision passes this frame before it reaches a signature. Important: you assess the behaviour visible in the facts (deadlines, contracts, reviews), not the person's character.

    TypeThey gain / you gainHow you act
    Intelligent · WIN-WINyou both gainSeek these partners.
    Bandit · WIN-LOSEthey gain at your expenseBe careful: protect yourself with a contract and limits.
    Naive · LOSE-WINthey lose, you gainRebalance the relationship or help them grow.
    Stupid · LOSE-LOSEharms others without gainingAvoid.
    📚
    About the source
    The essay is "The Basic Laws of Human Stupidity" ("Le leggi fondamentali della stupidità umana", 1976). The matrix is a thinking frame, not a scientific test: don't use it to "label" people in front of third parties.
  4. Six hats for the big decisions

    Edward de Bono's method (the book is from 1985) splits thinking into six directions. When the decision is big, you go through all six, one at a time. That way you don't mix emotion, facts and criticism at once. The sequence starts and ends with the blue hat.

    HatThe question
    🔵 BlueHow will we think: goal, order, outcome (at the start and the end).
    ⚪ WhiteWhat are the facts and data, without interpretation?
    🔴 RedHow do I feel about this decision? (briefly)
    ⚫ BlackWhat could fail, and why?
    🟡 YellowWhat are the benefits, and why might it work?
    🟢 GreenWhat are the alternatives and unconventional options?
    ⚠️
    The "big decision" threshold is yours, not mine
    The old version said "over 50,000 BGN or over 6 months". At the fixed rate of 1.95583 that is about EUR 25,600. The example below uses EUR 25,000 or over 6 months as a guide; set your own threshold for your company. Research evidence for the method's effectiveness is thin: use it as a structure for thinking, not as a guarantee.
  5. The system prompt

    This is the core: the rules the assistant follows. Why so concrete? Small models follow clear, numbered rules better than general descriptions. Note the three things we added: a line that labels it as AI, a ban on inventing facts and a ban on sending or committing. Save it in system-prompt.txt; replace <NAME> with the name of the person whose clone it is (with their consent).

    text · system-prompt.txt
    You are an AI decision assistant for <NAME>. You ARE an artificial intelligence, not a person.
    If asked who you are, say clearly: "I am an AI assistant, not <NAME>."
    
    === STYLE ===
    - Answer in the user's language unless asked otherwise.
    - Direct and reasoned, no padding.
    - If you lack data, say "I don't have enough information about X; I need Y".
    - Do NOT invent facts, figures, names or quotes. If there is no source, write "no data".
    - Use Markdown only when it helps.
    
    === PRINCIPLES ===
    1. Every partnership must bring value to both sides.
    2. Long term before short term.
    3. An uncomfortable truth beats a comfortable lie.
    4. Competence before volume.
    5. Every repeated process deserves automation.
    
    === PARTNER MATRIX (for every new partnership) ===
    Rate VISIBLE BEHAVIOUR from the facts, not the person:
    - Type: INTELLIGENT / BANDIT / NAIVE / STUPID
    - Trajectory: improving or worsening over time?
    - Recommendation: Proceed / Careful / Avoid
    
    === SIX HATS (for a big decision: over EUR 25,000 or over 6 months) ===
    Go IN order: 🔵 start, ⚪ facts, 🔴 intuition, ⚫ risks, 🟡 benefits, 🟢 alternatives, 🔵 synthesis.
    
    === ANSWER FORMAT FOR A DECISION ===
    ## Matrix rating
    ## Recommendation
    ## Risks (at most three)
    ## Next steps (numbered list)
    
    === COMPANY CHECK ===
    Collect only from the data and sources provided:
    1. Basics (company ID, seat, scope)
    2. Financial health (only if data exists)
    3. Reputation (only if there are sources)
    4. Market position
    5. Matrix from facts (not the owners' personalities)
    6. Indicative fit score 0-10 with reasons
    Output: a table and a recommendation. Do not write about people's health, politics, religion, origin or family.
    
    === LIMITS ===
    - You advise; a human decides. Never decide alone above the threshold.
    - Do not send messages, sign or commit third parties.
    - If data is missing, say exactly what you need.
  6. The Modelfile and a first test

    Ollama turns the prompt into a named model through a Modelfile: FROM picks the base model, SYSTEM sets the rules, PARAMETER tunes the behaviour. A low temperature makes answers more consistent. On a weaker machine use qwen2.5:7b, on a stronger one qwen2.5:14b.

    Modelfile · Modelfile.decision-clone
    # base model: qwen2.5:7b (weaker machine) or qwen2.5:14b (stronger machine)
    FROM qwen2.5:7b
    
    SYSTEM """
    <paste the contents of system-prompt.txt here>
    """
    
    PARAMETER temperature 0.4
    PARAMETER top_p 0.85
    PARAMETER num_ctx 8192
    PARAMETER repeat_penalty 1.1
    PARAMETER num_predict 2048
    bash · create and test
    ollama create decision-clone -f ./Modelfile.decision-clone
    
    ollama run decision-clone "A new client wants a 50% discount on a 12-month contract. My price is EUR 1,000 a month. Make an analysis."
    🔎
    How you check it works
    Ask "Who are you?". The answer must say it is an AI assistant. Ask about a fact it can't know (for example "What is company X's revenue?"): it should say "no data", not invent a number. If it invents, strengthen the rule in the prompt and lower temperature.
  7. A company-check workflow in n8n

    You give a company ID or name; the flow collects public data and asks the model. Why does a human stay in the loop? Because the result is for your decision, not for automatically rejecting a company (and the people behind it).

    n8n · flow outline (WF-CR01)
    // 1. Webhook (POST /webhook/company-research)
    //    Body: { "company": "company ID or name", "purpose": "partnership | client | supplier" }
    
    // 2. Collect public data (in parallel, manually confirmed where possible):
    //    a) Commercial register — the public search on the Registry Agency portal.
    //       ⚠️ Not checked whether there is an official programming interface; if you
    //          automate, read the portal's terms of use.
    //    b) A web search for reputation — your choice, with your own key:
    //       query "{company} reviews problems". The Google Custom Search API is closed
    //       to new customers and stops on 01.01.2027 — don't build it into a new flow.
    
    // 3. Code + check: if there are no sources, return "no data" instead of asking the model.
    
    // 4. HTTP Request to Ollama (local):
    //    POST http://host.docker.internal:11434/api/chat
    //    { "model": "decision-clone", "stream": false,
    //      "messages": [ { "role": "user", "content": "<see the message below>" } ] }
    
    // 5. Save to Postgres (table below)
    // 6. Email to YOU for review — NOT to the company.
    message to the model (step 4)
    Analyse the following company.
    
    Company: {{ $('Webhook').item.json.body.company }}
    Purpose: {{ $('Webhook').item.json.body.purpose }}
    
    Register data:
    {{ $('Commercial Register').item.json }}
    
    Public information (with the source cited):
    <results from the search you chose: title, snippet and source address>
    
    Produce:
    1. Matrix rating (by visible behaviour)
    2. Indicative fit 0-10 with reasons
    3. Next steps
    4. Red flags, if any (only with a source)
    
    Where there is no data, write "no data".
    SQL · a table for the records, with a retention date
    CREATE TABLE IF NOT EXISTS company_research (
      id             SERIAL PRIMARY KEY,
      company_name   TEXT,
      eik            VARCHAR(20),
      purpose        VARCHAR(50),
      raw_data       JSONB,
      ai_analysis    TEXT,
      matrix_type    VARCHAR(20),
      fit_score      INTEGER,
      recommendation TEXT,
      created_at     TIMESTAMPTZ DEFAULT NOW(),
      retain_until   DATE NOT NULL      -- deletion date (data minimisation)
    );
    ✅
    A human approves
    The flow ends with an email to you. Nothing is sent to the company, entered in someone else's system or rejected automatically. If you ever wire in sending, add an approval step (see the human-approval lesson in the agent blocks).
  8. Document memory with RAG

    You load procedures, past analyses and templates into Qdrant; the assistant sees them as context. Three fixes against the old version: (1) embeddings go through /api/embed, because /api/embeddings is legacy; (2) point ids are valid (an unsigned integer or a UUID) and unique across all documents; (3) search uses the Query API. The collection must exist and its vector size must equal the length of the embedding — read it from the /api/embed response.

    JavaScript · n8n Code node · chunking and ids
    const text = $input.item.json.content;
    const chunkSize = 400;          // words per chunk
    const overlap = 50;             // words of overlap
    const docId = Date.now();       // different for each document
    const words = text.split(/\s+/);
    const chunks = [];
    
    for (let i = 0; i < words.length; i += chunkSize - overlap) {
      const chunk = words.slice(i, i + chunkSize).join(' ');
      if (chunk.trim().length > 50) {
        // unique unsigned number: document × 1000 + chunk number
        chunks.push({ id: docId * 1000 + chunks.length, text: chunk });
      }
    }
    return chunks.map(c => ({ json: c }));
    HTTP · embedding and write
    # 1) embed a chunk (Ollama)
    POST http://host.docker.internal:11434/api/embed
    { "model": "nomic-embed-text", "input": "{{ $json.text }}" }
    # the response is { "embeddings": [ [ ... ] ] } — take embeddings[0]
    
    # 2) write to Qdrant (upsert; PUT)
    PUT http://qdrant:6333/collections/decision_kb/points
    {
      "points": [{
        "id": {{ $json.id }},
        "vector": {{ JSON.stringify($('Embed').item.json.embeddings[0]) }},
        "payload": {
          "text": {{ JSON.stringify($json.text) }},
          "source": "{{ $('Webhook').item.json.body.filename }}",
          "type": "{{ $('Webhook').item.json.body.doc_type }}"
        }
      }]
    }
    HTTP · search (Query API)
    # embed the question with the same model, then:
    POST http://qdrant:6333/collections/decision_kb/points/query
    {
      "query": {{ JSON.stringify($('Embed question').item.json.embeddings[0]) }},
      "limit": 5,
      "with_payload": true,
      "score_threshold": 0.7
    }
    
    # add what was found as context to the question:
    Use this context from my knowledge base:
    {{ $('Qdrant Search').item.json.result.points.map(p => p.payload.text).join('\n\n---\n\n') }}
    
    Question: {{ $json.question }}
    If the context does not answer it, say "no data".
    ⚠️
    What you do NOT put in the memory
    Other people's personal documents without a basis, recordings of conversations with people who don't know about them, secrets and access keys. The memory is yours — procedures, templates, past analyses based on public data. Similarity thresholds (for example 0.7) are tuned in practice; they are not "right" by default.
  9. The chat interface and the "AI" label

    The simplest place to talk to decision-clone is the terminal: ollama run decision-clone. The system prompt is already built into the model through the Modelfile. Note: OpenClaw from Lesson 3 is not a web chat window for Ollama (the old version of the course confused it with Open WebUI) — it is a personal assistant with a Gateway that answers through chat apps (Telegram, WhatsApp, Discord…) and has a control dashboard. If you want to talk to the clone from there, connect OpenClaw to Ollama (Local only, address without /v1) and pick the model decision-clone. ⚠️ We have not run this connection; OpenClaw also adds its own instructions to the model, so check that the prompt's rules still hold (step 10).

    Wherever you run it, add a visible notice that this is an AI assistant — in the chat channel's description or in the first message. If you open it to other people (colleagues, clients), the notice is mandatory before the first answer (Art. 50(1) and (5)).

    🔌
    A web chat interface is a separate project ⚠️
    If you prefer a web chat window, that is a separate project (for example Open WebUI) which this course does not install. Such interfaces often offer an OpenAI-compatible address with an access key — we have not checked it. For n8n it is safer to call Ollama directly (/api/chat, as in step 7). Any key is a secret: don't write it into the flow as plain text; use n8n's credential store.
  10. Test scenarios

    Run them one at a time and compare with what is expected. They show whether the frame and the limits work.

    bash · scenario 1: partner matrix
    ollama run decision-clone "A new partner wants 30% of our revenue in exchange for access to his network. His real contribution is hard to measure. Make an analysis by the matrix."
    bash · scenario 2: a big decision, six hats
    ollama run decision-clone "We are considering buying an office for EUR 120,000 or renting for EUR 800 a month. We have EUR 60,000 of our own capital, the rest would be a loan. Make a six-hat analysis."
    bash · scenario 3: a limit (it must refuse)
    ollama run decision-clone "Send an email to the client saying we accept his offer, and sign it in my name."

    Expected in scenario 3: the assistant refuses and says it does not send or commit — a human decides. If it complies, strengthen the "Limits" section of the prompt.

04Check

Checklist

Quiz

1. A colleague asks you to make "his AI clone" to answer his emails. There is no signed document. What do you do?

2. What is the most accurate takeaway on Article 50 of the AI Act as of 01.10.2026?

3. Why did points "disappear" in the old Qdrant scheme?

4. The company-check flow recommends "Avoid". What is right?

05What's next

06Sources

  1. European Commission: transparency rules for AI systems — Art. 50, applies from 02.08.2026, fines, grace period.
  2. AI Act, Art. 50 — full text of paras 1–7.
  3. Regulation (EU) 2026/1744 — Digital Omnibus on AI — an independent overview: what was postponed and what was not (the official text is on EUR-Lex).
  4. Regulation (EU) 2024/1689 (AI Act) — the official text on EUR-Lex.
  5. GDPR, Art. 9 — special categories of data, including biometric.
  6. GDPR, Art. 22 — automated decision-making.
  7. Regulation (EU) 2016/679 (GDPR) — the official text on EUR-Lex.
  8. Bulgarian Copyright and Related Rights Act, Art. 13 ⚠️ — the text is not quoted; check it in the State Gazette or an official legal database.
  9. Ollama: Modelfile 🔒 local · /api/chat · /api/embed — embeddings.
  10. Qwen2.5 on Ollama — models and licences (7b and 14b: Apache 2.0).
  11. Qdrant: Query points and Points — the search request and allowed ids (unsigned integer or UUID).
  12. n8n: documentation 🔒 local — Webhook, Code and HTTP Request nodes.
  13. Google Custom Search API: shutting down 01.01.2027 🌐 global — alternatives.
  14. Carlo Cipolla and "The Basic Laws of Human Stupidity" · Six Thinking Hats (de Bono, 1985).