# the user's flow and knowledge-tree principles (agent system design) Use when redesigning agent roles, rehber/AGENTS.md files, PM briefs, or cross-agent flows. ## How these principles get set - The user works them out through hypothetical flows ("agent X gets task Y, reads A, goes to B..."). Treat these as thought exercises: apply nothing, evaluate the flow step by step, name what is right, and propose the smallest correction with the mechanism (wasted hop, ownership crossing, merge conflict risk). - When he corrects a premise (e.g. pages are custom-designed, not template-filled), re-derive the flow and say plainly if his original version was closer than your correction. - Close each round by distilling the general principles (no concrete flow), and fold them into the plan file only when he asks. ## Knowledge tree - No mandatory reading chains ("first AGENTS.md, then vault/AGENTS.md, then ..."). The root is a need-based signpost: each line = "if you need X -> this one file". Agents open only the branch the task needs. - Always-needed context (SOUL.md identity/scope, root AGENTS.md map + absolute bans) is auto-loaded; everything else is on demand. - Max 3 hops from root to any fact. Inner nodes only point (with a "when to go here" line); facts live only in leaf notes. Copying facts into router files is what made rehbers stale. - One canonical place per fact; others link. Each guide/hub/contract node has an owner and date. No cross-domain wandering links; go back up a level instead. - Known name -> search directly; the tree is for "I don't know where it is". - "What" lives in the notes vault, "how" lives in skills. - An owner agent knows its own project path/hub note from its SOUL; it must not look itself up via Projeler/AGENTS.md (that file is for non-owners). - The notes vault is the main READ source, not only a write target. Frequent destinations (product hub notes, current system state, agent roles, lessons learned) are linked straight from the root; `vault/AGENTS.md` is the vault's single read map (which folder holds what, which folders are off-limits) for anything else, without repeating root bans. Keep one vault map only (pick it or `Başlangıç.md`, not both). - Write locations are per agent: each agent's the notes vault write area (absolute paths, or "does not write to the notes vault") lives only in its own SOUL.md, never in a shared write-map file or a role-table column. The 2-3 shared write rules (never delete, move to `_to_delete/`; lessons to `Öğrendiklerim/`; no secrets) sit under a "Kasaya yazarken" heading in root AGENTS.md. - Acceptance test: ask random agents "where is X" and count files opened (target <=3); run one example flow end to end and count hops and handoffs. ## User-defined coordinator roles - **Orchestrator (``):** routes work, gives PMs tasks and tracks them, integrates vetted tools into agents' pipelines, owns guide/system-state upkeep and final verification. Settings changes for other agents happen only within what the user explicitly delegated. Red lines and approval gates (delete, agent instruction files, push, publish, outbound messages) always apply. Holds no implementation skills; those live with specialists. - **Tool scout (``):** researches tools, tests them in its own scratch area, keeps one note per tool, and forwards useful tools to the orchestrator with note path, target agent/pipeline, test evidence, risk and cost. It does not edit other agents' skills or settings. Product-repo work goes on a branch; merge/push/publish need the user. - Do not narrow an agent whose real use outgrew its SOUL; formalize the real use (see `roster-review.md` step 3). - **Sales & Marketing (``):** decides how a product is promoted and sold: audience, positioning, key message, language strategy, channel choice, launch calendar and day-by-day plan, metrics. Its output is a plan plus briefs; production stays with specialists (content calendar, text, visual and video specialists). Posting, account creation, ad spend and outbound messages need the user. ## Research before first-time work - No agent's built-in knowledge is enough for a task it has not done before (new product, channel, tool, market). Before planning or building, it does sourced, dated deep web research (`web_search`/`web_extract`, a deep-research tool if available), keeps findings in a separate note, and bases the plan on that note; the tool scout is the go-to helper for tool/platform discovery. Put this as a required section in every new agent's SOUL and a mandatory phase 1 in every first-time brief (research note path + plan note path as two deliverables). ## Shared infrastructure conventions (ports, registries, system state) When proposing a system-wide mechanism, critique it against these before presenting (the user asks for this): - **Drift:** a hand-maintained central list (port registry, status page) becomes a second source of truth and goes stale. Keep the truth in the thing's own config (`package.json` dev script, `serve.sh`) and generate the overview table with a script that scans configs + live state. - **Enforcement:** a rule that depends on agents remembering to call a tool will be skipped; embed it in the default command (e.g. the port fixed in the project's `npm run dev`, or a wrapper like `portless next dev`) so following it needs no memory. - **Weight:** size the mechanism to the measured problem; leases, expiry and reaping need a daemon/cron, which is another thing to break. - **Blast radius:** never auto-stop "orphan" processes; ownership is a guess and a running worker's dev server looks orphaned. - **Role fit and exposure:** system administration belongs to the orchestrator; a product app (e.g. a dashboard reachable from the phone over a private network) gets read-only views of system state, never kill/route-change buttons. Check portability: the app must work on a machine without that system tooling. - **Claims:** "nothing is listening on it now" is not "unused"; on-demand services (self-hosted tools, Gradio apps) keep private-network serve mappings while stopped. Map each entry to an owner before proposing removal. - **Ports specifically:** the tested mechanism (named `.localhost` URLs via portless wrapped into each project's dev script, no sudo, no trust-store change) and its acceptance test are in `local-web-app-dev-loop` -> `references/local-port-routing.md`. ## Flow / separation of duties - Context travels in the brief: the receiving agent should not need to search. - PM gives only what/why/for whom. Brief fields: goal (including "custom-designed, not a template" when true), audience and desired action, product facts (status, store links, key message), product identity (colors, font, tone, media location), constraints (path to the relevant contract file), acceptance criteria. Design and implementation decisions belong to the specialist, never the PM. - Web pages: the web specialist owns both design and code (a separate designer role adds a handoff and loses intent). It first offers 2-3 design drafts, one is chosen, then it codes on a branch from current main. - A boundary between two agents is a short contract file owned by the host. Example: each company-site product page is designed from scratch per product; the site PM owns an "ürün sayfası ekleme kuralları" file (routes, shared nav/footer, privacy links, perf budget, stack), reviews against it, merges, and publishes. The product PM briefs the web specialist and checks content fit. - Pre-publish gate: security reviewer's short checklist (secrets in code, external scripts, form safety, privacy link), then the user's approval. - Each agent updates only its own hub note. ## New project kickoff - The orchestrator opens it: the notes vault hub note `///.md` (frontmatter `durum`, `sahip`, `guncelleme`, `tur`; purpose, deadline, repo path, stack, model endpoint, decisions, flow), repo `/` (`git init -b main`), brand/research notes in the repo `docs/`. Commit/push the vault only when the user asks. - Normally a PM writes the brief. When the deadline is hours away (e.g. a demo tomorrow), the orchestrator may write the web specialist's brief itself and says so in the report; the brief fields above still apply. - Secrets the worker needs are provided by the user (or with the user's approval) as a mode-600 file the worker moves into place without reading; never paste a key into a brief. - Dispatch the web specialist in two phases (phase 1 ends with design-draft screenshots for the user to pick, phase 2 builds the pick); recipe in `local-web-app-dev-loop` → `references/client-demo-apps.md`.