import%20marimo%0A%0A__generated_with%20%3D%20%220.25.2%22%0Aapp%20%3D%20marimo.App(%0A%20%20%20%20width%3D%22medium%22%2C%0A%20%20%20%20app_title%3D%22Stretch%3A%20agents%20for%20your%20pipeline%2C%20a%20showcase%22%2C%0A)%0A%0Awith%20app.setup%3A%0A%20%20%20%20%23%20The%20setup%20cell%20runs%20first.%20It%20holds%20the%20imports%20and%20the%20survey's%20tables%20the%20cells%20below%20show.%0A%20%20%20%20import%20marimo%20as%20mo%0A%20%20%20%20import%20pandas%20as%20pd%0A%0A%20%20%20%20import%20course%20%20%23%20this%20course's%20helpers%3A%20the%20survey's%20tables%20and%20file%20locations%0A%0A%20%20%20%20%23%20The%20survey%2C%20clean%20as%20module%202%20teaches%3A%20every%20region's%20rows%2C%20removed%20households%20and%20voided%20rows%20left%20out%0A%20%20%20%20members%20%3D%20course.members()%0A%20%20%20%20households%20%3D%20course.households()%0A%20%20%20%20catch%20%3D%20course.child(%22catch%22)%0A%20%20%20%20species%20%3D%20course.codes(%22species%22)%20%20%23%20the%20species%20code%20list%3A%20code%2C%20name%2C%20group%0A%20%20%20%20education%20%3D%20course.codes(%22education%22)%5B%22code%22%5D.tolist()%20%20%23%20the%20valid%20codes%20of%20mem_education%2C%20highest%20level%20completed%0A%20%20%20%20planted%20%3D%20course.planted_defects()%20%20%23%20every%20defect%20the%20course%20planted%3B%20a%20real%20survey%20has%20no%20such%20list%0A%20%20%20%20HOUSEHOLD%20%3D%20%5B%22region_code%22%2C%20%22hh_id%22%5D%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_()%3A%0A%20%20%20%20mo.md(r%22%22%22%0A%20%20%20%20%23%20Stretch%3A%20agents%20for%20your%20pipeline%2C%20a%20showcase%0A%0A%20%20%20%20For%20when%20you%20have%20finished%20module%209%20and%20want%20to%20see%20where%20the%20pipeline%20can%20go%20next.%20A%20**coding%20agent**%20can%20draft%20much%20of%20what%20modules%202%20to%209%20had%20you%20write%20by%20hand%3A%20a%20port%20of%20an%20R%20script%2C%20edit%20rules%20from%20the%20codebook%2C%20a%20detector%20with%20tests.%20This%20notebook%20shows%20what%20that%20looks%20like%20on%20the%20survey%2C%20and%20what%20it%20asks%20of%20you.%20It%20is%20a%20showcase%3A%20there%20are%20no%20exercises%20and%20no%20checks%2C%20and%20the%20few%20code%20cells%20only%20show%20a%20file%20or%20compute%20a%20figure%20the%20text%20quotes.%0A%0A%20%20%20%20%7C%20section%20%7C%20what%20it%20shows%20%7C%0A%20%20%20%20%7C%3A--%7C%3A--%7C%0A%20%20%20%20%7C%201%20%C2%B7%20What%20an%20agent%20is%2C%20and%20what%20it%20sends%20away%20%7C%20the%20loop%20an%20agent%20runs%3B%20the%20cloud%20path%20and%20the%20local%20path%3B%20what%20leaves%20the%20machine%20on%20each%20%7C%0A%20%20%20%20%7C%202%20%C2%B7%20A%20harness%20around%20your%20pipeline%20%7C%20the%20brief%20in%20%60AGENTS.md%60%2C%20the%20handover%20folder%2C%20tests%20as%20the%20judge%2C%20git%20as%20undo%20%7C%0A%20%20%20%20%7C%203%20%C2%B7%20Limiting%20what%20an%20agent%20can%20do%20%7C%20permission%20settings%2C%20sandboxes%2C%20a%20read-only%20database%20account%2C%20local-only%20switches%20%7C%0A%20%20%20%20%7C%204%20%C2%B7%20Four%20examples%20from%20the%20survey%20%7C%20four%20tasks%20from%20processing%20a%20survey%2C%20told%20the%20same%20way%2C%20and%20one%20failure%20review%20catches%20%7C%0A%20%20%20%20%7C%205%20%C2%B7%20The%20local%20demo%2C%20and%20where%20this%20goes%20next%20%7C%20the%20trainer's%20demonstration%20on%20a%20local%20model%2C%20and%20what%20a%20full%20training%20would%20cover%20%7C%0A%0A%20%20%20%20**Dates%20matter%20here.**%20These%20tools%20change%20faster%20than%20a%20course%20page.%20Every%20fact%20about%20a%20tool%20links%20to%20the%20tool's%20own%20documentation%20and%20says%20when%20it%20was%20checked%3B%20read%20the%20page%20again%20before%20you%20rely%20on%20it.%0A%20%20%20%20%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_()%3A%0A%20%20%20%20mo.md(r%22%22%22%0A%20%20%20%20%23%23%201%20%C2%B7%20What%20an%20agent%20is%2C%20and%20what%20it%20sends%20away%3A%20cloud%20and%20local%0A%0A%20%20%20%20**What%20a%20coding%20agent%20is.**%20A%20coding%20agent%20is%20a%20language%20model%20in%20a%20loop%20with%20tools.%20At%20each%20turn%20the%20model%20reads%20the%20conversation%20so%20far%20and%20picks%20an%20action%3A%20read%20a%20file%2C%20run%20a%20command%2C%20write%20a%20file.%20The%20agent%20program%20does%20it%2C%20and%20the%20result%20goes%20back%20into%20the%20conversation%20for%20the%20next%20turn.%20The%20conversation%20grows%20with%20every%20file%20the%20agent%20reads%20and%20every%20command's%20output%2C%20and%20**the%20whole%20conversation%20is%20what%20the%20model%20sees**.%0A%0A%20%20%20%20%7C%20step%20%7C%20what%20the%20agent%20does%20%7C%20what%20reaches%20the%20model%20%7C%0A%20%20%20%20%7C%3A--%7C%3A--%7C%3A--%7C%0A%20%20%20%20%7C%201%20%7C%20you%20type%20the%20task%20%7C%20your%20prompt%20%7C%0A%20%20%20%20%7C%202%20%7C%20reads%20%60handover%2Fcodebook.csv%60%20with%20its%20file%20tool%20%7C%20the%20codebook's%20contents%20%7C%0A%20%20%20%20%7C%203%20%7C%20runs%20%60python%20count.py%60%20%7C%20the%20command%2C%20and%20everything%20it%20printed%20%7C%0A%20%20%20%20%7C%204%20%7C%20writes%20%60rules.csv%60%20%7C%20the%20file%20it%20wrote%3A%20the%20model%20wrote%20it%2C%20so%20it%20has%20it%20already%20%7C%0A%0A%20%20%20%20**Two%20paths.**%20On%20the%20**cloud%20path**%20the%20model%20runs%20on%20a%20provider's%20servers%2C%20and%20the%20conversation%20travels%20there%20at%20every%20turn%3A%20Claude%20Code%2C%20OpenAI's%20Codex%20and%20GitHub%20Copilot%20work%20this%20way.%20On%20the%20**local%20path**%20the%20model%20is%20an%20**open-weight%20model**%2C%20one%20whose%20weights%20you%20can%20download%2C%20such%20as%20Qwen%2C%20and%20it%20runs%20on%20your%20own%20computer%2C%20so%20the%20conversation%20stays%20there.%20The%20agent%20program%20runs%20on%20your%20computer%20either%20way%3B%20what%20differs%20is%20where%20the%20model%20is.%0A%0A%20%20%20%20%23%23%23%20The%20cloud%20path%3A%20Claude%20Code%20as%20the%20worked%20example%0A%0A%20%20%20%20Claude%20Code%20is%20the%20course's%20worked%20example.%20What%20its%20documentation%20says%2C%20checked%20on%209%20November%202026%20(%5Bdata%20usage%5D(https%3A%2F%2Fcode.claude.com%2Fdocs%2Fen%2Fdata-usage)%2C%20%5Bsetup%5D(https%3A%2F%2Fcode.claude.com%2Fdocs%2Fen%2Fsetup))%3A%0A%0A%20%20%20%20%7C%20%7C%20Claude%20Code%20(Anthropic)%20%7C%0A%20%20%20%20%7C%3A--%7C%3A--%7C%0A%20%20%20%20%7C%20what%20it%20sends%20%7C%20%22all%20user%20prompts%20and%20model%20outputs%22%3B%20a%20file%20the%20agent%20reads%2C%20and%20a%20command's%20output%2C%20are%20part%20of%20the%20conversation%20it%20sends%20%7C%0A%20%20%20%20%7C%20account%20%7C%20a%20Pro%2C%20Max%2C%20Ultra%2C%20Team%2C%20Enterprise%20or%20Console%20account%3B%20the%20free%20plan%20does%20not%20include%20it%20%7C%0A%20%20%20%20%7C%20training%20on%20your%20data%20%7C%20consumer%20plans%20(Free%2C%20Pro%2C%20Max%2C%20Ultra)%20when%20the%20user's%20setting%20allows%20it%3B%20commercial%20terms%20(Team%2C%20Enterprise%2C%20API)%20only%20if%20the%20customer%20opts%20in%20%7C%0A%20%20%20%20%7C%20how%20long%20the%20provider%20keeps%20it%20%7C%20consumer%20accounts%3A%205%20years%20with%20the%20training%20setting%20on%2C%2030%20days%20with%20it%20off%3B%20commercial%20accounts%3A%2030%20days%3B%20zero%20data%20retention%20only%20for%20qualified%20Claude%20for%20Enterprise%20accounts%20%7C%0A%20%20%20%20%7C%20on%20your%20own%20disk%20%7C%20session%20transcripts%20in%20plain%20text%20under%20%60~%2F.claude%2Fprojects%2F%60%2C%20kept%2030%20days%20by%20default%20%7C%0A%0A%20%20%20%20Codex%20and%20GitHub%20Copilot%20send%20what%20they%20read%20to%20their%20providers%20in%20the%20same%20way%3B%20this%20page%20did%20not%20check%20their%20terms%2C%20so%20read%20their%20data%20pages%20for%20your%20plan%20before%20you%20open%20a%20client's%20files%20with%20either.%0A%0A%20%20%20%20%23%23%23%20The%20local%20path%3A%20an%20open-weight%20model%20in%20Ollama%2C%20driven%20by%20Pi%0A%0A%20%20%20%20The%20local%20path%20has%20two%20parts.%20**Ollama**%20runs%20the%20model%20on%20your%20computer%20and%20answers%20on%20%60http%3A%2F%2Flocalhost%3A11434%60.%20**Pi**%20(%5Bpi.dev%5D(https%3A%2F%2Fpi.dev%2F))%2C%20an%20open-source%20coding%20agent%20(MIT%20license)%2C%20drives%20a%20model%20Ollama%20serves%20once%20its%20settings%20file%20%60~%2F.pi%2Fagent%2Fmodels.json%60%20names%20Ollama's%20address%2C%20with%20no%20account.%20OpenAI's%20**Codex%20CLI**%20with%20%60--oss%60%20can%20drive%20Ollama%20too%2C%20as%20the%20alternative.%20Checked%20on%209%20November%202026%3A%0A%0A%20%20%20%20%7C%20%7C%20what%20the%20documentation%20says%20%7C%0A%20%20%20%20%7C%3A--%7C%3A--%7C%0A%20%20%20%20%7C%20Ollama%2C%20local%20%7C%20%22Ollama%20runs%20locally.%20We%20don't%20see%20your%20prompts%20or%20data%20when%20you%20run%20locally.%22%20(%5BOllama%20FAQ%5D(https%3A%2F%2Fdocs.ollama.com%2Ffaq))%20%7C%0A%20%20%20%20%7C%20Ollama%2C%20cloud%20%7C%20Ollama%20also%20serves%20cloud%20models%2C%20which%20run%20in%20Ollama's%20cloud%20and%20carry%20%60cloud%60%20in%20their%20names%3A%20%60qwen3.5%3Acloud%60%20in%20its%20%5BPi%20page%5D(https%3A%2F%2Fdocs.ollama.com%2Fintegrations%2Fpi)%2C%20%60gpt-oss%3A120b-cloud%60%20in%20its%20%5BCodex%20page%5D(https%3A%2F%2Fdocs.ollama.com%2Fintegrations%2Fcodex)%20(%5BOllama%20cloud%5D(https%3A%2F%2Fdocs.ollama.com%2Fcloud))%20%7C%0A%20%20%20%20%7C%20Ollama's%20context%20window%20%7C%20under%2024%20GiB%20of%20graphics%20memory%20the%20default%20context%20is%204k%20tokens%3B%20tasks%20such%20as%20%22web%20search%2C%20agents%2C%20and%20coding%20tools%20should%20be%20set%20to%20at%20least%2064000%20tokens%22%20(%5Bcontext%20length%5D(https%3A%2F%2Fdocs.ollama.com%2Fcontext-length))%20%7C%0A%20%20%20%20%7C%20Pi's%20brief%20%7C%20Pi%20reads%20%60AGENTS.md%60%20(or%20%60CLAUDE.md%60)%20from%20the%20folder%20it%20starts%20in%20and%20the%20folders%20above%20it%20(%5BPi%20configuration%5D(https%3A%2F%2Fpi.dev%2Fdocs%2Flatest%2Fconfiguration))%20%7C%0A%20%20%20%20%7C%20Pi's%20model%20%7C%20%60models.json%60%20names%20Ollama%20as%20a%20provider%3A%20%60%22baseUrl%22%3A%20%22http%3A%2F%2Flocalhost%3A11434%2Fv1%22%60%2C%20%60%22api%22%3A%20%22openai-completions%22%60%20and%20the%20model's%20id%20(%5BPi%20models%5D(https%3A%2F%2Fpi.dev%2Fdocs%2Flatest%2Fmodels))%20%7C%0A%20%20%20%20%7C%20Pi%20on%20Windows%20%7C%20Pi%20needs%20a%20bash%20shell%3B%20for%20most%20native%20Windows%20users%2C%20Git%20for%20Windows%20provides%20one%20(%5BPi%20on%20Windows%5D(https%3A%2F%2Fpi.dev%2Fdocs%2Flatest%2Fwindows))%20%7C%0A%20%20%20%20%7C%20Codex%20CLI%20%7C%20%60codex%20--oss%60%20uses%20Ollama's%20models%3B%20Ollama%20advises%20a%20context%20of%20at%20least%2064k%20tokens%20for%20it%20(%5BCodex%20page%5D(https%3A%2F%2Fdocs.ollama.com%2Fintegrations%2Fcodex))%20%7C%0A%0A%20%20%20%20The%20**context%20window**%20is%20how%20much%20conversation%20a%20model%20reads%20at%20once%2C%20counted%20in%20tokens.%20An%20agent's%20conversation%20holds%20the%20brief%2C%20every%20file%20it%20read%20and%20every%20output%2C%20so%20a%204k%20window%20cannot%20hold%20it.%0A%20%20%20%20%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_()%3A%0A%20%20%20%20mo.md(r%22%22%22%0A%20%20%20%20%23%23%23%20What%20leaves%20the%20machine%2C%20path%20by%20path%0A%0A%20%20%20%20The%20same%20session%2C%20on%20each%20path.%20%22Leaves%22%20means%20a%20copy%20reaches%20a%20computer%20that%20is%20not%20yours.%0A%0A%20%20%20%20%7C%20what%20the%20session%20holds%20%7C%20cloud%20path%20%7C%20local%20path%2C%20set%20up%20as%20section%203%20says%20%7C%0A%20%20%20%20%7C%3A--%7C%3A--%7C%3A--%7C%0A%20%20%20%20%7C%20your%20prompts%20and%20the%20brief%20%7C%20sent%20to%20the%20provider%20%7C%20stays%20%7C%0A%20%20%20%20%7C%20every%20file%20the%20agent%20reads%20%7C%20sent%20%7C%20stays%20%7C%0A%20%20%20%20%7C%20every%20command's%20output%2C%20including%20a%20script%20that%20prints%20a%20table%20%7C%20sent%20%7C%20stays%20%7C%0A%20%20%20%20%7C%20the%20code%20the%20model%20writes%20%7C%20written%20by%20the%20provider's%20model%2C%20so%20the%20provider%20has%20it%20%7C%20stays%20%7C%0A%20%20%20%20%7C%20a%20copy%20on%20your%20own%20disk%20%7C%20the%20agent's%20transcripts%20(Claude%20Code%3A%20%60~%2F.claude%2Fprojects%2F%60%2C%2030%20days)%20%7C%20whatever%20the%20agent%20saves%20on%20your%20disk%20%7C%0A%20%20%20%20%7C%20the%20agent%20program's%20own%20traffic%20%7C%20update%20checks%20and%20telemetry%2C%20each%20with%20its%20own%20switch%20%7C%20Pi's%20automatic%20network%20activity%2C%20off%20with%20%60PI_OFFLINE%3D1%60%20%7C%0A%0A%20%20%20%20A%20local%20path%20stays%20local%20only%20if%20three%20settings%20hold%3A%20the%20model%20has%20no%20%60cloud%60%20in%20its%20name%2C%20Ollama's%20cloud%20features%20are%20off%2C%20and%20the%20agent%20is%20not%20given%20web%20tools.%20Section%203%20names%20the%20switches.%0A%0A%20%20%20%20%23%23%23%20Cloud%20or%20local%3A%20what%20each%20costs%20you%0A%0A%20%20%20%20%7C%20%7C%20cloud%20path%20%7C%20local%20path%20%7C%0A%20%20%20%20%7C%3A--%7C%3A--%7C%3A--%7C%0A%20%20%20%20%7C%20speed%20%7C%20the%20provider's%20hardware%20%7C%20your%20graphics%20card%3B%20a%20model%20larger%20than%20the%20card%20spills%20to%20the%20processor%20and%20runs%20slower%20(%60ollama%20ps%60%20shows%20the%20split)%20%7C%0A%20%20%20%20%7C%20quality%20%7C%20the%20provider's%20largest%20models%20%7C%20the%20models%20a%20laptop's%20card%20holds%20are%20much%20smaller%3B%20how%20well%20they%20do%20this%20course's%20tasks%20is%20not%20measured%20anywhere%20we%20found%20%7C%0A%20%20%20%20%7C%20cost%20%7C%20a%20paid%20plan%20or%20pay%20per%20use%20%7C%20no%20fee%20for%20the%20model%3B%20the%20hardware%20you%20have%2C%20and%20the%20time%20to%20set%20it%20up%20%7C%0A%20%20%20%20%7C%20what%20leaves%20%7C%20everything%20in%20the%20conversation%2C%20kept%20by%20the%20provider%20for%20its%20retention%20period%20%7C%20nothing%2C%20with%20the%20switches%20of%20section%203%20%7C%0A%20%20%20%20%7C%20reproducibility%20%7C%20the%20same%20brief%20gives%20different%20code%20on%20different%20runs%20%7C%20the%20same%2C%20though%20the%20model%20file%20on%20your%20disk%20stays%20the%20version%20you%20pulled%20%7C%0A%20%20%20%20%7C%20review%20burden%20%7C%20every%20line%20still%20needs%20review%20%7C%20the%20same%20review%2C%20and%20expect%20more%20to%20fix%20from%20a%20small%20model%20%7C%0A%0A%20%20%20%20Neither%20column%20wins%20outright.%20For%20a%20client's%20microdata%2C%20%22what%20leaves%22%20decides%2C%20and%20the%20decision%20is%20the%20institution's%20(section%202).%20For%20code%20written%20from%20a%20codebook%20and%20a%20synthetic%20sample%2C%20the%20cloud%20path's%20speed%20and%20quality%20may%20be%20worth%20it.%0A%20%20%20%20%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_()%3A%0A%20%20%20%20mo.md(r%22%22%22%0A%20%20%20%20%23%23%202%20%C2%B7%20A%20harness%20around%20your%20pipeline%0A%0A%20%20%20%20**The%20problem.**%20An%20agent%20given%20only%20%22write%20edit%20rules%20for%20the%20survey%22%20fills%20every%20gap%20with%20a%20guess%3A%20a%20shape%20for%20the%20rules%2C%20a%20test%20framework%2C%20what%20a%20blank%20education%20code%20means%2C%20which%20files%20to%20read.%20Each%20guess%20is%20plausible%3B%20together%20they%20give%20you%20code%20you%20must%20read%20line%20by%20line%20to%20learn%20what%20it%20assumed.%20A%20**harness**%20closes%20the%20gaps%20before%20the%20agent%20starts.%20It%20has%20four%20parts%3A%20a%20brief%2C%20a%20folder%20that%20holds%20only%20what%20may%20be%20read%2C%20tests%20that%20decide%20when%20the%20work%20is%20done%2C%20and%20git%20to%20undo%20what%20went%20wrong.%0A%0A%20%20%20%20%23%23%23%20AGENTS.md%3A%20the%20brief%0A%0A%20%20%20%20A%20**brief**%20tells%20the%20agent%20what%20it%20may%20read%2C%20what%20to%20make%2C%20in%20which%20shape%2C%20and%20how%20it%20knows%20it%20is%20done.%20It%20goes%20in%20a%20file%20named%20%60AGENTS.md%60%20at%20the%20top%20of%20the%20agent's%20folder.%20Claude%20Code%20reads%20it%20when%20the%20folder%20has%20no%20%60CLAUDE.md%60%20(%5Bmemory%5D(https%3A%2F%2Fcode.claude.com%2Fdocs%2Fen%2Fmemory))%3B%20Codex%20reads%20it%20from%20the%20project's%20root%20down%20to%20the%20folder%20it%20starts%20in%20(%5BCodex%20AGENTS.md%5D(https%3A%2F%2Flearn.chatgpt.com%2Fdocs%2Fagent-configuration%2Fagents-md))%3B%20Pi%20reads%20it%20from%20its%20folder%20and%20the%20folders%20above%20(section%201).%20All%20checked%20on%209%20November%202026.%20A%20brief%20for%20this%20survey%3A%0A%20%20%20%20%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_()%3A%0A%20%20%20%20mo.md(r%22%22%22%0A%20%20%20%20%60%60%60markdown%0A%20%20%20%20%23%20Brief%3A%20edit%20rules%20for%20the%20survey%20of%20fishing%20households%0A%0A%20%20%20%20%23%23%20Data%0A%20%20%20%20Read%20only%20%60handover%2F%60%3A%20the%20codebook%20(%60codebook.csv%60)%2C%20the%20rules%20in%20words%20(%60codebook_rules.csv%60)%2C%20the%20code%20lists%20(%60codes%2F%60)%2C%20the%20schema%20(%60schema.csv%60)%20and%20a%20synthetic%20sample%20(%60sample%2F%60)%20with%20its%20planted%20defects%20(%60sample%2Fplanted_defects.csv%60).%20The%20survey's%20microdata%20is%20not%20in%20this%20folder%3A%20do%20not%20look%20for%20it.%0A%0A%20%20%20%20%23%23%20Task%0A%20%20%20%201.%20Write%20%60rules.csv%60%3A%20one%20rule%20per%20row%20for%20every%20rule%20in%20%60handover%2Fcodebook_rules.csv%60%20that%20one%20table%20can%20check.%0A%20%20%20%202.%20Write%20%60run_rules.py%60%2C%20which%20runs%20a%20rules%20file%20on%20a%20folder%20of%20tables%20and%20writes%20a%20failure%20report.%0A%20%20%20%203.%20Write%20tests%20in%20%60tests%2F%60%20that%20run%20the%20rules%20on%20%60handover%2Fsample%2F%60%20and%20find%20every%20planted%20defect%20a%20rule%20covers.%0A%0A%20%20%20%20%23%23%20Rules%20file%0A%20%20%20%20Columns%2C%20in%20this%20order%3A%20%60rule%60%2C%20%60table%60%2C%20%60applies_to%60%2C%20%60must_hold%60%2C%20%60action%60%2C%20%60message%60.%20A%20row%20fails%20where%20%60must_hold%60%20is%20false%20or%20blank.%20Scope%20a%20rule%20to%20the%20members%20the%20questionnaire%20asks%3A%20the%20education%20item%20is%20asked%20from%206%20years%20old.%20A%20household%20is%20%60region_code%60%20and%20%60hh_id%60%20together%3A%20%60hh_id%60%20repeats%20across%20regions.%0A%0A%20%20%20%20%23%23%20Tests%0A%20%20%20%20Run%20%60uv%20run%20--with%20pytest%20pytest%20-q%20tests%60.%20Every%20test%20passes%20before%20you%20say%20you%20are%20done%3B%20if%20one%20cannot%20pass%2C%20say%20which%20and%20why.%0A%20%20%20%20%60%60%60%0A%20%20%20%20%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_()%3A%0A%20%20%20%20mo.md(r%22%22%22%0A%20%20%20%20Each%20section%20closes%20one%20gap%3A%20**Data**%20names%20one%20folder%2C%20so%20the%20agent%20has%20no%20reason%20to%20look%20elsewhere%20and%20a%20reviewer%20can%20see%20it%20was%20told%3B%20**Task**%20names%20the%20files%3B%20**Rules%20file**%20gives%20module%204's%20specification%20table%20and%20the%20survey's%20two%20traps%3B%20**Tests**%20makes%20a%20command%2C%20not%20the%20agent's%20say-so%2C%20the%20definition%20of%20done.%20A%20brief%20is%20a%20request%2C%20not%20a%20guard%3A%20Claude%20Code's%20documentation%20says%20it%20treats%20its%20instruction%20files%20%22as%20context%2C%20not%20enforced%20configuration%22.%20What%20enforces%20the%20Data%20section%20is%20section%203.%0A%0A%20%20%20%20%23%23%23%20The%20handover%20folder%20and%20the%20microdata%20rule%0A%0A%20%20%20%20**The%20law%2C%20for%20Philippine%20official%20statistics.**%20Republic%20Act%2010625%2C%20the%20Philippine%20Statistical%20Act%20of%202013%2C%20section%2026%3A%20individual%20data%20that%20respondents%20give%20to%20the%20statistical%20inquiries%2C%20surveys%20and%20censuses%20of%20the%20government's%20statistical%20system%20are%20**privileged%20communication**%2C%20and%20only%20aggregates%20that%20do%20not%20refer%20to%20an%20individual%20may%20be%20released.%20Section%2027%20makes%20a%20breach%20an%20offense%2C%20with%20fines%20and%20imprisonment%2C%20%22whether%20by%20carelessness%2C%20improper%20behavior%2C%20behavior%20with%20malicious%20intent%22.%20The%20National%20Privacy%20Commission's%20Advisory%202024-04%20(19%20December%202024)%20applies%20the%20Data%20Privacy%20Act%20to%20personal%20data%20used%20to%20develop%20or%20deploy%20AI%20systems%2C%20testing%20included%3B%20when%20the%20processing%20is%20outsourced%2C%20the%20institution%20%22shall%20remain%20accountable%22%20for%20what%20its%20processor%20does%3B%20and%20it%20asks%20for%20data%20minimization%20(leave%20out%20by%20default%20any%20personal%20data%20unlikely%20to%20help)%20and%20for%20people%20who%20review%20what%20an%20AI%20system%20produces.%20Read%20them%20at%20%5Blawphil.net%5D(https%3A%2F%2Flawphil.net%2Fstatutes%2Frepacts%2Fra2013%2Fra_10625_2013.html)%20and%20%5Bprivacy.gov.ph%5D(https%3A%2F%2Fprivacy.gov.ph%2Fwp-content%2Fuploads%2F2025%2F02%2FAdvisory-2024.12.19-Guidelines-on-Artificial-Intelligence-w-SGD.pdf)%3B%20both%20were%20read%20on%208%20November%202026.%0A%0A%20%20%20%20**The%20rule%20this%20course%20follows.**%20A%20client's%20**microdata**%2C%20the%20rows%20its%20respondents%20gave%2C%20stays%20on%20the%20machines%20and%20with%20the%20tools%20its%20institution%20has%20approved%20for%20it.%20Nothing%20from%20it%20goes%20to%20a%20web%20service%2C%20a%20third%20party%20or%20a%20published%20page%20unless%20that%20institution%20has%20approved%20the%20path.%20Which%20path%20is%20approved%20is%20the%20institution's%20decision%2C%20not%20the%20analyst's%20and%20not%20this%20course's%3A%20an%20institution%20may%20approve%20a%20cloud%20agent%20under%20an%20enterprise%20agreement%2C%20a%20local%20model%20on%20its%20own%20machines%2C%20or%20neither.%20Whatever%20the%20path%2C%20an%20agent%20does%20most%20of%20its%20work%20well%20on%20less%20than%20the%20microdata.%20That%20is%20the%20**handover%20folder**%3A%0A%0A%20%20%20%20%7C%20in%20the%20handover%20folder%20%7C%20what%20it%20holds%20%7C%20why%20the%20agent%20needs%20it%20%7C%20microdata%3F%20%7C%0A%20%20%20%20%7C%3A--%7C%3A--%7C%3A--%7C%3A--%7C%0A%20%20%20%20%7C%20%60codebook.csv%60%2C%20%60codebook_rules.csv%60%2C%20%60codes%2F%60%20%7C%20each%20variable's%20type%2C%20label%20and%20valid%20codes%3B%20the%20rules%20in%20words%3B%20the%20code%20lists%20%7C%20the%20rules%20are%20written%20from%20it%20%7C%20no%3A%20it%20describes%20the%20questionnaire%20%7C%0A%20%20%20%20%7C%20%60schema.csv%60%20%7C%20each%20table's%20columns%20and%20their%20database%20types%2C%20with%20no%20rows%20%7C%20names%20and%20types%20to%20write%20code%20against%20%7C%20no%3A%20names%20and%20types%20only%20%7C%0A%20%20%20%20%7C%20%60sample%2F%60%20and%20its%20%60planted_defects.csv%60%20%7C%20a%20**synthetic%20sample**%20with%20its%20planted%20defects%20listed%20%7C%20something%20to%20run%20the%20code%20and%20the%20tests%20on%20%7C%20no%3A%20no%20respondent%20gave%20these%20rows%20%7C%0A%0A%20%20%20%20At%20work%2C%20make%20the%20sample%20from%20the%20**codebook**%2C%20with%20a%20program%20that%20never%20opens%20the%20microdata%3A%20draw%20each%20value%20from%20the%20code%20lists%20and%20ranges%20the%20codebook%20states%2C%20then%20plant%20every%20kind%20of%20mistake%20the%20rules%20must%20catch%2C%20where%20you%20know%20them.%20A%20slice%20of%20real%20microdata%20is%20microdata%2C%20and%20so%20is%20a%20column%20of%20it%20shuffled%2C%20since%20every%20value%20in%20it%20is%20still%20a%20respondent's.%20In%20this%20course%20every%20row%20is%20synthetic%2C%20so%20the%20course's%20survey%20can%20stand%20in%20for%20the%20sample.%0A%0A%20%20%20%20%23%23%23%20Tests%20as%20the%20judge%2C%20git%20as%20undo%0A%0A%20%20%20%20**Tests%20decide%20when%20the%20work%20is%20done.**%20The%20brief%20names%20the%20command%2C%20and%20the%20synthetic%20sample's%20list%20of%20planted%20defects%20says%20what%20the%20tests%20must%20find.%20A%20test%20the%20agent%20wrote%20passes%20on%20the%20agent's%20idea%20of%20the%20task%2C%20which%20may%20be%20wrong%3A%20section%204%20shows%20how.%20So%20add%20tests%20of%20your%20own%20from%20what%20you%20know%20of%20the%20survey%2C%20an%20operator%20of%20exactly%2016%2C%20a%20child%20with%20no%20education%20code%2C%20one%20%60hh_id%60%20in%20two%20regions%2C%20and%20keep%20them%20where%20the%20agent's%20work%20must%20pass%20them.%0A%0A%20%20%20%20**Git%20makes%20every%20change%20undoable.**%20Commit%20before%20the%20session%20and%20let%20the%20agent%20work%20on%20a%20branch.%20%60git%20status%60%20then%20lists%20every%20file%20it%20added%20or%20changed%2C%20including%20files%20you%20did%20not%20expect%20it%20to%20touch%2C%20%60git%20diff%60%20shows%20each%20changed%20line%2C%20and%20%60git%20restore%60%20or%20%60git%20revert%60%20undoes%20what%20you%20reject.%20An%20agent%20that%20writes%20many%20files%20in%20a%20minute%20is%20much%20easier%20to%20try%20when%20one%20command%20takes%20them%20all%20back.%0A%20%20%20%20%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_()%3A%0A%20%20%20%20mo.md(r%22%22%22%0A%20%20%20%20%23%23%203%20%C2%B7%20Limiting%20what%20an%20agent%20can%20do%0A%0A%20%20%20%20**The%20problem.**%20The%20brief%20asks%20the%20agent%20to%20read%20only%20%60handover%2F%60.%20An%20agent%20that%20wants%20a%20number%20from%20the%20microdata%20can%20still%20write%20a%20three-line%20script%20that%20opens%20it%2C%20run%20the%20script%2C%20and%20read%20the%20output%3B%20the%20output%20joins%20the%20conversation%20like%20any%20other.%20Each%20guard%20below%20closes%20part%20of%20that%2C%20and%20each%20has%20a%20limit%20worth%20knowing.%0A%0A%20%20%20%20%23%23%23%20Claude%20Code's%20permission%20settings%0A%0A%20%20%20%20From%20%5BConfigure%20permissions%5D(https%3A%2F%2Fcode.claude.com%2Fdocs%2Fen%2Fpermissions)%2C%20checked%20on%209%20November%202026%3A%0A%0A%20%20%20%20-%20**Rules.**%20%60allow%60%2C%20%60ask%60%20and%20%60deny%60%20lists%20in%20%60.claude%2Fsettings.json%60%2C%20each%20entry%20a%20tool%20and%20what%20it%20applies%20to%3A%20%60Read(.%2Fsecrets%2F**)%60%2C%20%60Bash(npm%20run%20*)%60%2C%20%60WebFetch%60.%20They%20are%20evaluated%20%22deny%2C%20then%20ask%2C%20then%20allow%22%2C%20and%20the%20first%20match%20decides.%0A%20%20%20%20-%20**The%20limit.**%20Read%20and%20Edit%20deny%20rules%20stop%20Claude's%20file%20tools%20and%20the%20file%20commands%20it%20recognizes%20in%20a%20shell%20(%60cat%60%2C%20%60head%60%2C%20%60sed%60).%20They%20%22don't%20apply%20to%20%E2%80%A6%20arbitrary%20subprocesses%20that%20read%20or%20write%20files%20indirectly%2C%20like%20a%20Python%20or%20Node%20script%20that%20opens%20files%20itself%22%3B%20the%20page%20points%20to%20the%20sandbox%20for%20that.%0A%20%20%20%20-%20**Reads%20outside%20the%20folder.**%20The%20setting%20%60permissions.blockReadsOutsideWorkingDirectories%60%20makes%20the%20file%20tools%20refuse%20reads%20outside%20the%20working%20folders%2C%20with%20the%20same%20limit%3A%20a%20script%20is%20not%20a%20file%20tool.%0A%0A%20%20%20%20**Permission%20modes**%20set%20how%20often%20it%20asks%20you%3A%0A%0A%20%20%20%20%7C%20mode%20%7C%20what%20it%20does%20%7C%0A%20%20%20%20%7C%3A--%7C%3A--%7C%0A%20%20%20%20%7C%20%60default%60%20(Manual)%20%7C%20asks%20before%20each%20tool's%20first%20use%20%7C%0A%20%20%20%20%7C%20%60acceptEdits%60%20%7C%20accepts%20file%20edits%20and%20common%20file%20commands%20in%20the%20working%20folder%20without%20asking%20%7C%0A%20%20%20%20%7C%20%60plan%60%20%7C%20reads%20files%20and%20runs%20read-only%20commands%20to%20explore%2C%20and%20does%20not%20edit%20your%20source%20files%20%7C%0A%20%20%20%20%7C%20%60auto%60%20%7C%20runs%20without%20routine%20prompts%3B%20a%20classifier%20checks%20shell%20commands%20and%20network%20requests%20first%20%7C%0A%20%20%20%20%7C%20%60dontAsk%60%20%7C%20refuses%20everything%20that%20would%20prompt%2C%20and%20runs%20only%20what%20the%20rules%20allow%20%7C%0A%20%20%20%20%7C%20%60bypassPermissions%60%20%7C%20skips%20the%20prompts%2C%20except%20for%20actions%20no%20mode%20approves%20%7C%0A%0A%20%20%20%20%23%23%23%20Claude%20Code's%20sandbox%0A%0A%20%20%20%20From%20%5BSandboxing%5D(https%3A%2F%2Fcode.claude.com%2Fdocs%2Fen%2Fsandboxing)%2C%20checked%20on%209%20November%202026%3A%20the%20sandbox%20is%20%22a%20boundary%20that%20the%20operating%20system%20enforces%20around%20the%20shell%20commands%20Claude%20runs%22%2C%20and%20the%20processes%20those%20commands%20start%2C%20a%20script%20included.%20It%20is%20off%20by%20default%20(%60%2Fsandbox%60%20in%20a%20session%2C%20or%20%60sandbox.enabled%60).%20Commands%20may%20write%20in%20the%20working%20folder%20and%20a%20temporary%20folder%3B%20they%20may%20read%20the%20whole%20computer%20unless%20you%20deny%20it%20with%20%60sandbox.filesystem.denyRead%60%3B%20they%20reach%20the%20network%20through%20a%20proxy%20that%20checks%20each%20host%20against%20the%20domains%20you%20allow%2C%20which%20start%20empty.%20It%20runs%20on%20macOS%2C%20Linux%20and%20WSL2%3B%20%22on%20native%20Windows%2C%20Claude%20Code%20runs%20commands%20unsandboxed%22.%20It%20covers%20shell%20commands%20only%3A%20the%20file%20tools%20follow%20the%20permission%20rules%2C%20so%20the%20two%20work%20together.%20The%20settings%20below%20combine%20them%2C%20for%20a%20project%20folder%20that%20holds%20only%20the%20brief%20and%20the%20handover%20folder%3A%0A%20%20%20%20%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_()%3A%0A%20%20%20%20mo.md(r%22%22%22%0A%20%20%20%20%60%60%60json%0A%20%20%20%20%7B%0A%20%20%20%20%20%20%22permissions%22%3A%20%7B%0A%20%20%20%20%20%20%20%20%22allow%22%3A%20%5B%22Bash(uv%20run%20--with%20pytest%20pytest%20*)%22%5D%2C%0A%20%20%20%20%20%20%20%20%22deny%22%3A%20%5B%22WebFetch%22%5D%0A%20%20%20%20%20%20%7D%2C%0A%20%20%20%20%20%20%22sandbox%22%3A%20%7B%0A%20%20%20%20%20%20%20%20%22enabled%22%3A%20true%2C%0A%20%20%20%20%20%20%20%20%22filesystem%22%3A%20%7B%0A%20%20%20%20%20%20%20%20%20%20%22denyRead%22%3A%20%5B%22~%2F%22%5D%2C%0A%20%20%20%20%20%20%20%20%20%20%22allowRead%22%3A%20%5B%22.%22%5D%0A%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%20%20%7D%0A%20%20%20%20%7D%0A%20%20%20%20%60%60%60%0A%0A%20%20%20%20In%20the%20project's%20%60.claude%2Fsettings.json%60%2C%20for%20a%20project%20inside%20your%20home%20folder%3A%20the%20tests%20run%20without%20a%20prompt%3B%20the%20fetch%20tool%20is%20refused%3B%20and%20every%20command%20the%20agent%20runs%2C%20a%20script%20included%2C%20reads%20nothing%20in%20your%20home%20folder%20but%20the%20project.%20A%20folder%20of%20microdata%20outside%20your%20home%20folder%2C%20on%20another%20drive%20or%20a%20server%20share%2C%20needs%20its%20own%20%60denyRead%60%20line.%20The%20%60denyRead%60%20and%20%60allowRead%60%20lines%20are%20the%20sandboxing%20page's%20own%20example%2C%20which%20also%20warns%20that%20in%20%60~%2F.claude%2Fsettings.json%60%20the%20%60.%60%20would%20mean%20%60~%2F.claude%60.%0A%20%20%20%20%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_()%3A%0A%20%20%20%20mo.md(r%22%22%22%0A%20%20%20%20%23%23%23%20Docker%20Sandboxes%0A%0A%20%20%20%20**Docker%20Sandboxes**%20run%20an%20agent%20inside%20a%20small%20virtual%20machine%2C%20a%20microVM%2C%20on%20your%20computer%3B%20the%20%60sbx%60%20command%20line%20creates%20and%20manages%20them.%20From%20Docker's%20%5Bsecurity%20model%5D(https%3A%2F%2Fdocs.docker.com%2Fai%2Fsandboxes%2Fsecurity%2F)%20and%20%5Bget%20started%5D(https%3A%2F%2Fdocs.docker.com%2Fai%2Fsandboxes%2Fget-started%2F)%20pages%2C%20checked%20on%209%20November%202026%3A%0A%0A%20%20%20%20-%20Each%20sandbox%20has%20its%20own%20kernel%20and%20its%20own%20Docker%20Engine%3B%20outside%20the%20folder%20you%20give%20it%2C%20%22the%20agent%20cannot%20access%20your%20host%20filesystem%22.%0A%20%20%20%20-%20%60sbx%20run%20claude%60%20in%20a%20folder%20starts%20Claude%20Code%20there%20with%20that%20folder%20mounted.%20A%20direct%20mount%20is%20read-write%2C%20so%20the%20agent%20edits%20your%20files%20in%20place%3B%20in%20clone%20mode%20the%20folder%20is%20mounted%20read-only%20and%20the%20agent%20works%20on%20a%20private%20clone.%0A%20%20%20%20-%20Outbound%20traffic%20goes%20through%20a%20proxy%20on%20your%20computer%20under%20%22a%20deny-by-default%20policy%22%3B%20at%20the%20first%20sign-in%20you%20choose%20a%20preset%2C%20Balanced%20or%20Locked%20Down%2C%20and%20%60sbx%20policy%20ls%60%20lists%20the%20rules.%0A%20%20%20%20-%20Credentials%20are%20added%20by%20that%20proxy%20to%20outgoing%20requests%3A%20%22The%20raw%20credential%20values%20never%20enter%20the%20VM.%22%0A%0A%20%20%20%20The%20limit%20is%20the%20same%20as%20the%20folder%20rule's%3A%20whatever%20is%20in%20the%20mounted%20folder%2C%20the%20agent%20can%20read.%20A%20sandbox%20around%20a%20folder%20that%20holds%20the%20microdata%20protects%20your%20computer%2C%20not%20the%20microdata.%0A%0A%20%20%20%20%23%23%23%20A%20read-only%20database%20account%0A%0A%20%20%20%20Module%202%20read%20the%20survey%20from%20a%20MySQL%20server%20as%20the%20account%20%60learner%60%2C%20which%20this%20course's%20server%20grants%20%60SELECT%60%20on%20the%20three%20regional%20databases%20and%20nothing%20else%2C%20and%20attached%20each%20database%20%60READ_ONLY%60.%20An%20agent%20connected%20that%20way%20cannot%20change%20or%20delete%20a%20row.%20It%20can%20still%20read%20every%20row%20it%20selects%2C%20and%20each%20row%20it%20reads%20joins%20the%20conversation.%20A%20read-only%20account%20protects%20the%20database%3B%20it%20does%20not%20keep%20the%20microdata%20in.%20Give%20an%20agent%20a%20database%20account%20only%20on%20a%20database%20that%20may%20be%20read%3A%20a%20synthetic%20copy%2C%20or%20the%20schema%20alone.%0A%0A%20%20%20%20%23%23%23%20Pi%20and%20Ollama%3A%20keeping%20the%20traffic%20local%0A%0A%20%20%20%20Checked%20on%209%20November%202026%3A%0A%0A%20%20%20%20-%20%60OLLAMA_NO_CLOUD%3D1%60%20(or%20%60%22disable_ollama_cloud%22%3A%20true%60%20in%20%60~%2F.ollama%2Fserver.json%60)%20runs%20Ollama%20in%20local-only%20mode%2C%20without%20cloud%20models%20or%20web%20search%20(%5BOllama%20FAQ%5D(https%3A%2F%2Fdocs.ollama.com%2Ffaq)).%0A%20%20%20%20-%20%60PI_OFFLINE%3D1%60%20(or%20%60pi%20--offline%60)%20disables%20Pi's%20%22automatic%20network%20activity%2C%20including%20model%20catalog%20refreshes%22%20(%5BPi%20environment%20variables%5D(https%3A%2F%2Fpi.dev%2Fdocs%2Flatest%2Fenvironment-variables)%2C%20%5BPi%20CLI%5D(https%3A%2F%2Fpi.dev%2Fdocs%2Flatest%2Fcli)).%0A%20%20%20%20-%20%60ollama%20launch%20pi%60%20sets%20Pi%20up%20in%20one%20step%20and%20%22configures%20Ollama%20as%20a%20provider%20including%20web%20tools%22%2C%20which%20reach%20the%20web%3B%20for%20the%20local%20path%2C%20write%20%60models.json%60%20by%20hand%20instead%20(%5BOllama's%20Pi%20page%5D(https%3A%2F%2Fdocs.ollama.com%2Fintegrations%2Fpi)).%0A%20%20%20%20-%20Codex%20through%20Ollama%3A%20%22web-search%20requests%20sent%20through%20the%20Ollama%20profile%20are%20executed%20by%20Ollama%20for%20both%20local%20and%20cloud%20models%22%3B%20Ollama's%20page%20shows%20%60-c%20'web_search%3D%22disabled%22'%60%20to%20turn%20it%20off%20(%5BOllama's%20Codex%20page%5D(https%3A%2F%2Fdocs.ollama.com%2Fintegrations%2Fcodex)).%0A%0A%20%20%20%20These%20switches%20keep%20the%20traffic%20on%20your%20computer.%20They%20do%20not%20limit%20which%20files%20the%20agent%20reads%2C%20so%20the%20folder%20rule%20still%20holds%3A%20on%20a%20machine%20the%20institution%20approved%20for%20its%20microdata%2C%20a%20local%20agent%20may%20be%20given%20more%20than%20the%20handover%20folder%2C%20and%20that%20too%20is%20the%20institution's%20decision.%0A%20%20%20%20%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_()%3A%0A%20%20%20%20mo.md(r%22%22%22%0A%20%20%20%20%23%23%204%20%C2%B7%20Four%20examples%20from%20the%20survey%0A%0A%20%20%20%20Four%20tasks%20from%20processing%20a%20survey%2C%20each%20told%20the%20same%20way%3A%20the%20task%2C%20the%20brief%20you%20would%20give%2C%20what%20an%20agent%20does%20with%20it%2C%20what%20review%20looks%20for%2C%20and%20what%20doing%20it%20safely%20takes.%20No%20recordings%20of%20these%20sessions%20exist%3B%20each%20describes%20what%20to%20expect%2C%20not%20a%20session%20that%20took%20place.%0A%0A%20%20%20%20%23%23%23%20Example%201%3A%20port%20an%20R%20tabulation%20to%20Python%0A%0A%20%20%20%20%7C%20%7C%20%7C%0A%20%20%20%20%7C%3A--%7C%3A--%7C%0A%20%20%20%20%7C%20the%20task%20%7C%20An%20R%20script%20your%20team%20already%20runs%20tabulates%20members%20by%20their%20role%20in%20fishing%20and%20by%20sex%3A%20%60case_when%60%20recodes%20with%20%22No%20answer%22%20and%20%22Invalid%20value%22%20categories%2C%20then%20counts%20by%20group.%20Module%205%20did%20this%20by%20hand.%20%7C%0A%20%20%20%20%7C%20the%20brief%20%7C%20The%20R%20script%2C%20the%20codebook%20and%20the%20synthetic%20sample.%20%22Write%20a%20Python%20function%20that%20gives%20the%20same%20table.%20Write%20a%20test%20that%20runs%20the%20R%20script%20and%20your%20function%20on%20the%20sample%20and%20compares%20them%20cell%20by%20cell.%22%20%7C%0A%20%20%20%20%7C%20what%20an%20agent%20does%20%7C%20It%20reads%20the%20R%20script%2C%20writes%20pandas%20with%20%60np.select%60%20for%20each%20%60case_when%60%2C%20and%20runs%20both%20on%20the%20sample.%20If%20R%20is%20not%20installed%2C%20it%20cannot%20run%20the%20comparison%2C%20and%20it%20may%20say%20so%20or%20skip%20it%3A%20the%20brief%20should%20say%20which.%20%7C%0A%20%20%20%20%7C%20what%20review%20looks%20for%20%7C%20The%20%22No%20answer%22%20and%20%22Invalid%20value%22%20categories%20present%20and%20in%20the%20R%20order%3B%20a%20member%20with%20every%20role%20flag%20blank%20counted%20as%20No%20answer%2C%20not%20dropped%3B%20codes%20compared%20as%20numbers%20in%20both%3B%20every%20category%20shown%20even%20when%20its%20count%20is%20zero.%20%7C%0A%20%20%20%20%7C%20doing%20it%20safely%20%7C%20The%20R%20script%20is%20code%2C%20not%20data%2C%20and%20may%20go%20to%20any%20approved%20path.%20The%20comparison%20runs%20on%20the%20synthetic%20sample.%20On%20the%20real%20microdata%2C%20you%20run%20both%20yourself%2C%20on%20your%20machine.%20%7C%0A%0A%20%20%20%20%23%23%23%20Example%202%3A%20draft%20edit%20rules%20from%20the%20codebook%0A%0A%20%20%20%20%7C%20%7C%20%7C%0A%20%20%20%20%7C%3A--%7C%3A--%7C%0A%20%20%20%20%7C%20the%20task%20%7C%20Module%204's%20specification%20table%3A%20one%20row%20per%20rule%20of%20%60codebook_rules.csv%60.%20%7C%0A%20%20%20%20%7C%20the%20brief%20%7C%20Section%202's%20%60AGENTS.md%60.%20%7C%0A%20%20%20%20%7C%20what%20an%20agent%20does%20%7C%20It%20writes%20a%20%60rules.csv%60%20that%20reads%20well%20and%20runs%2C%20and%20tests%20that%20pass%20on%20the%20sample.%20%7C%0A%20%20%20%20%7C%20what%20review%20looks%20for%20%7C%20Each%20rule's%20scope%20and%20boundary%20against%20the%20codebook's%20words.%20Three%20places%20a%20draft%20goes%20wrong%3A%20%2216%20years%20old%20or%20over%22%20written%20%60mem_age%20%3E%2016%60%3B%20the%20education%20rule%20applied%20to%20every%20member%2C%20so%20every%20child%20under%206%20fails%3B%20a%20species%20rule%20scoped%20to%20%60catch_species.notna()%60%2C%20so%20a%20blank%20species%20passes.%20%7C%0A%20%20%20%20%7C%20doing%20it%20safely%20%7C%20The%20agent%20needs%20the%20codebook%2C%20not%20a%20row%20of%20data.%20This%20task%20can%20go%20to%20a%20cloud%20path%20with%20nothing%20confidential%20in%20the%20folder.%20%7C%0A%0A%20%20%20%20%23%23%23%20Example%203%3A%20a%20local%20model%20reads%20the%20species%20named%20as%20%22other%22%0A%0A%20%20%20%20%7C%20%7C%20%7C%0A%20%20%20%20%7C%3A--%7C%3A--%7C%0A%20%20%20%20%7C%20the%20task%20%7C%20The%20catch%20table%20has%20a%20species%20code%2C%20%60catch_species%60.%20For%20code%20997%2C%20%22Other%20species%2C%20to%20be%20named%22%2C%20the%20respondent's%20own%20name%20for%20the%20fish%20is%20in%20%60catch_species_text%60.%20Is%20that%20fish%20really%20missing%20from%20the%20list%2C%20or%20is%20it%20a%20listed%20species%20under%20another%20name%3A%20a%20local%20name%2C%20a%20spelling%2C%20a%20name%20for%20one%20kind%20of%20a%20listed%20group%3F%20%7C%0A%20%20%20%20%7C%20the%20brief%20%7C%20The%20species%20code%20list%3B%20for%20each%20row%2C%20its%20name.%20%22Answer%20%60listed%60%2C%20%60not%20listed%60%20or%20%60unclear%60%2C%20and%20for%20%60listed%60%20the%20code%20the%20name%20points%20to.%20Change%20nothing.%22%20%7C%0A%20%20%20%20%7C%20what%20an%20agent%20does%20%7C%20Here%20the%20model%20is%20the%20reader%2C%20not%20a%20code%20writer%3A%20a%20script%20sends%20each%20row%20to%20the%20model%20on%20Ollama's%20local%20address%20and%20collects%20its%20answers%20in%20a%20table.%20A%20model%20knows%20spelling%20variants%20and%20regional%20names%20that%20no%20code%20list%20holds.%20%7C%0A%20%20%20%20%7C%20what%20review%20looks%20for%20%7C%20Its%20%60listed%60%20answers%2C%20read%20by%20a%20person%2C%20and%20its%20answers%20on%20rows%20where%20you%20know%20the%20truth.%20It%20suggests%3B%20a%20person%20edits%20the%20code.%20%7C%0A%20%20%20%20%7C%20doing%20it%20safely%20%7C%20This%20one%20reads%20the%20microdata%20row%20by%20row%2C%20so%20it%20runs%20on%20a%20local%20model%20with%20%60OLLAMA_NO_CLOUD%3D1%60%2C%20on%20a%20machine%20the%20institution%20approved.%20%7C%0A%0A%20%20%20%20A%20plain%20join%20of%20the%20names%20on%20the%20list's%20own%20names%20settles%20the%20rows%20that%20name%20a%20listed%20species%20exactly%3B%20the%20cell%20below%20shows%20how%20many%2C%20and%20what%20is%20left.%20A%20model%20earns%20its%20place%20on%20what%20the%20join%20leaves%20over%2C%20and%20on%20a%20real%20survey's%20names%2C%20which%20come%20in%20more%20spellings%20and%20languages%20than%20any%20list.%0A%20%20%20%20%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell%0Adef%20_()%3A%0A%20%20%20%20%23%20The%20catch%20rows%20coded%20997%20with%20a%20name%3A%20does%20the%20name%20match%20a%20name%20on%20the%20species%20list%3F%0A%20%20%20%20_named%20%3D%20catch.assign(said%3Dcatch%5B%22catch_species_text%22%5D.fillna(%22%22).str.strip())%0A%20%20%20%20_named%20%3D%20_named%5B(_named%5B%22catch_species%22%5D%20%3D%3D%20997)%20%26%20(_named%5B%22said%22%5D%20!%3D%20%22%22)%5D%0A%20%20%20%20_code_of%20%3D%20pd.Series(species%5B%22code%22%5D.to_numpy()%2C%20index%3Dspecies%5B%22name%22%5D.str.casefold())%0A%20%20%20%20_named%20%3D%20_named.assign(name_points_to%3D_named%5B%22said%22%5D.str.casefold().map(_code_of).astype(%22Int64%22))%0A%20%20%20%20_left%20%3D%20_named%5B_named%5B%22name_points_to%22%5D.isna()%5D%0A%20%20%20%20mo.vstack(%5B%0A%20%20%20%20%20%20%20%20mo.md(f%22Of%20the%20survey's%20**%7Blen(catch)%3A%2C%7D**%20catch%20rows%2C%20**%7Blen(_named)%3A%2C%7D**%20are%20coded%20997%20with%20a%20name.%20A%20join%20on%20the%20list's%20names%20finds%20**%7Bint(_named%5B'name_points_to'%5D.notna().sum())%7D**%20that%20name%20a%20listed%20species%20exactly%2C%20%22%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20f%22and%20leaves%20**%7Blen(_left)%7D**%20rows%20holding%20**%7B_left%5B'said'%5D.nunique()%7D**%20distinct%20names.%20Those%20names%20are%20for%20a%20person%2C%20or%20a%20local%20model%2C%20to%20read%3A%22)%2C%0A%20%20%20%20%20%20%20%20_left.groupby(%22said%22).size().rename(%22rows%22).sort_values(ascending%3DFalse).rename_axis(%22catch_species_text%22).reset_index()%2C%0A%20%20%20%20%5D)%0A%20%20%20%20return%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_()%3A%0A%20%20%20%20mo.md(r%22%22%22%0A%20%20%20%20%23%23%23%20Example%204%3A%20one%20agent%20reviews%20another's%20work%0A%0A%20%20%20%20%7C%20%7C%20%7C%0A%20%20%20%20%7C%3A--%7C%3A--%7C%0A%20%20%20%20%7C%20the%20task%20%7C%20A%20second%20opinion%20on%20a%20detector%20the%20first%20agent%20wrote.%20%7C%0A%20%20%20%20%7C%20the%20brief%20%7C%20The%20detector's%20code%2C%20the%20codebook%20and%20the%20review%20list%3A%20every%20join%20and%20key%2C%20every%20blank%2C%20every%20boundary%2C%20the%20tests'%20own%20data.%20Not%20the%20first%20agent's%20summary%20of%20its%20work%3A%20a%20reviewer%20given%20a%20conclusion%20tends%20to%20confirm%20it.%20%7C%0A%20%20%20%20%7C%20what%20an%20agent%20does%20%7C%20It%20reads%20the%20code%20and%20reports%20suspicions%2C%20at%20best%20each%20with%20a%20small%20test%20that%20fails%20on%20it.%20In%20Claude%20Code%2C%20%60plan%60%20mode%20lets%20it%20read%20and%20explore%20without%20editing.%20%7C%0A%20%20%20%20%7C%20what%20review%20looks%20for%20%7C%20Each%20finding%20is%20a%20claim%3A%20run%20its%20test%20and%20see%20it%20fail%20before%20you%20believe%20it.%20Two%20agents%20built%20on%20similar%20models%20can%20share%20a%20blind%20spot%2C%20so%20a%20clean%20report%20is%20not%20a%20clean%20detector.%20%7C%0A%20%20%20%20%7C%20doing%20it%20safely%20%7C%20The%20same%20folder%2C%20the%20same%20guards%3B%20the%20reviewer%20needs%20no%20more%20data%20than%20the%20author%20had.%20%7C%0A%20%20%20%20%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.function%0Adef%20agents_code()%20-%3E%20str%3A%0A%20%20%20%20%22%22%22A%20detector%20as%20an%20agent%20might%20write%20it%2C%20with%20three%20mistakes%3A%20an%20illustration%2C%20not%20a%20recorded%20session.%22%22%22%0A%20%20%20%20return%20'''def%20flag_members(members%2C%20households%2C%20education)%3A%0A%20%20%20%20%23%20Members%20whose%20answers%20break%20M1%2C%20M2%2C%20M4%20or%20M5%2C%20with%20their%20province%20and%20interviewer%20for%20the%20review%20table%0A%20%20%20%20found%20%3D%20pd.concat(%5B%0A%20%20%20%20%20%20%20%20members%5B~members%5B%22mem_sex%22%5D.isin(%5B1%2C%202%5D)%5D.assign(rule%3D%22M1%22)%2C%0A%20%20%20%20%20%20%20%20members%5B(members%5B%22mem_age%22%5D%20%3C%200)%20%7C%20(members%5B%22mem_age%22%5D%20%3E%20110)%5D.assign(rule%3D%22M2%22)%2C%0A%20%20%20%20%20%20%20%20members%5B(members%5B%22mem_role_operator%22%5D%20%3D%3D%201)%20%26%20(members%5B%22mem_age%22%5D%20%3C%3D%2016)%5D.assign(rule%3D%22M4%22)%2C%0A%20%20%20%20%20%20%20%20members%5B~members%5B%22mem_education%22%5D.isin(education)%5D.assign(rule%3D%22M5%22)%2C%0A%20%20%20%20%5D)%0A%20%20%20%20review%20%3D%20found.merge(households%5B%5B%22hh_id%22%2C%20%22province_code%22%2C%20%22hh_interviewer%22%5D%5D%2C%20on%3D%22hh_id%22)%0A%20%20%20%20return%20review%5B%5B%22region_code%22%2C%20%22province_code%22%2C%20%22hh_id%22%2C%20%22mem_line%22%2C%20%22hh_interviewer%22%2C%20%22rule%22%5D%5D%0A'''%0A%0A%0A%40app.function%0Adef%20review_fixes()%20-%3E%20list%5Btuple%5Bstr%2C%20str%2C%20str%5D%5D%3A%0A%20%20%20%20%22%22%22The%20three%20changes%20review%20makes%20to%20the%20agent's%20detector%3A%20the%20line%20as%20written%2C%20as%20corrected%2C%20and%20why.%22%22%22%0A%20%20%20%20return%20%5B%0A%20%20%20%20%20%20%20%20('(members%5B%22mem_age%22%5D%20%3C%3D%2016)'%2C%20'(members%5B%22mem_age%22%5D%20%3C%2016)'%2C%20%22**The%20boundary.**%20%5C%22A%20member%20who%20runs%20a%20unit%20is%2016%20years%20old%20or%20over%5C%22%3A%20an%20operator%20of%20exactly%2016%20is%20valid.%22)%2C%0A%20%20%20%20%20%20%20%20('members%5B~members%5B%22mem_education%22%5D.isin(education)%5D'%2C%20'members%5B(members%5B%22mem_age%22%5D%20%3E%3D%206)%20%26%20~members%5B%22mem_education%22%5D.isin(education)%5D'%2C%0A%20%20%20%20%20%20%20%20%20%22**The%20blank.**%20A%20child%20under%206%20is%20not%20asked%20the%20education%20item%3B%20%60isin%60%20is%20false%20for%20a%20blank%2C%20so%20every%20such%20child%20failed.%20The%20rule%20is%20about%20members%206%20years%20old%20and%20over%2C%20and%20only%20they%20are%20checked.%22)%2C%0A%20%20%20%20%20%20%20%20('households%5B%5B%22hh_id%22%2C%20%22province_code%22%2C%20%22hh_interviewer%22%5D%5D%2C%20on%3D%22hh_id%22)'%2C%0A%20%20%20%20%20%20%20%20%20'households%5B%5B%22region_code%22%2C%20%22hh_id%22%2C%20%22province_code%22%2C%20%22hh_interviewer%22%5D%5D%2C%20on%3D%5B%22region_code%22%2C%20%22hh_id%22%5D%2C%20how%3D%22left%22%2C%20validate%3D%22many_to_one%22)'%2C%0A%20%20%20%20%20%20%20%20%20%22**The%20key.**%20%60hh_id%60%20repeats%20across%20regions%2C%20so%20the%20join%20matched%20each%20flag%20to%20every%20household%20with%20that%20number%20in%20any%20region.%22)%2C%0A%20%20%20%20%5D%0A%0A%0A%40app.function%0Adef%20detector_from(code%3A%20str)%3A%0A%20%20%20%20%22%22%22The%20function%20flag_members%20defined%20by%20the%20code%20shown%20on%20this%20page%2C%20so%20what%20runs%20is%20what%20you%20read.%22%22%22%0A%20%20%20%20namespace%20%3D%20%7B%22pd%22%3A%20pd%7D%0A%20%20%20%20exec(code%2C%20namespace)%0A%20%20%20%20return%20namespace%5B%22flag_members%22%5D%0A%0A%0A%40app.function%0Adef%20reviewed_code()%20-%3E%20str%3A%0A%20%20%20%20%22%22%22The%20agent's%20detector%20with%20review's%20three%20changes%20made.%22%22%22%0A%20%20%20%20code%20%3D%20agents_code()%0A%20%20%20%20for%20wrong%2C%20right%2C%20_%20in%20review_fixes()%3A%0A%20%20%20%20%20%20%20%20assert%20code.count(wrong)%20%3D%3D%201%2C%20wrong%20%20%23%20each%20change%20applies%20to%20one%20line%20of%20the%20agent's%20code%0A%20%20%20%20%20%20%20%20code%20%3D%20code.replace(wrong%2C%20right)%0A%20%20%20%20return%20code%0A%0A%0A%40app.function%0Adef%20review_score(flags%3A%20pd.DataFrame)%20-%3E%20dict%3A%0A%20%20%20%20%22%22%22A%20detector's%20flags%20against%20the%20households%20the%20course%20planted%20defects%20of%20these%20rules%20in.%22%22%22%0A%20%20%20%20kinds%20%3D%20%5B%22code_not_in_list%22%2C%20%22age_out_of_range%22%2C%20%22operator_too_young%22%5D%0A%20%20%20%20households_planted%20%3D%20planted%5B(planted%5B%22table%22%5D%20%3D%3D%20%22member%22)%20%26%20planted%5B%22kind%22%5D.isin(kinds)%5D%5BHOUSEHOLD%5D.drop_duplicates()%0A%20%20%20%20outside%20%3D%20flags.merge(households_planted%2C%20how%3D%22left%22%2C%20indicator%3DTrue)%0A%20%20%20%20return%20%7B%0A%20%20%20%20%20%20%20%20%22rows%20flagged%22%3A%20len(flags)%2C%0A%20%20%20%20%20%20%20%20%22member%20and%20rule%20listed%20more%20than%20once%22%3A%20int(flags.duplicated(%5B%22region_code%22%2C%20%22hh_id%22%2C%20%22mem_line%22%2C%20%22rule%22%5D).sum())%2C%0A%20%20%20%20%20%20%20%20%22planted%20households%20found%22%3A%20f%22%7Blen(households_planted.merge(flags%5BHOUSEHOLD%5D.drop_duplicates()))%7D%20of%20%7Blen(households_planted)%7D%22%2C%0A%20%20%20%20%20%20%20%20%22rows%20in%20no%20planted%20household%22%3A%20int((outside%5B%22_merge%22%5D%20%3D%3D%20%22left_only%22).sum())%2C%0A%20%20%20%20%7D%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_()%3A%0A%20%20%20%20mo.md(r%22%22%22%0A%20%20%20%20%23%23%23%20What%20review%20catches%3A%20an%20illustration%0A%0A%20%20%20%20The%20detector%20below%20is%20an%20**illustration**%2C%20written%20for%20this%20page%2C%20not%20the%20record%20of%20a%20session.%20It%20is%20the%20kind%20of%20code%20an%20agent%20writes%20from%20a%20brief%20that%20leaves%20the%20survey's%20traps%20out%3A%20it%20runs%2C%20and%20a%20test%20on%20one%20region's%20adults%20passes.%20The%20highlighted%20lines%20hold%20its%20three%20mistakes%2C%20one%20for%20each%20of%20the%20first%20three%20items%20of%20the%20review%20list.%0A%20%20%20%20%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_()%3A%0A%20%20%20%20_wrong%20%3D%20%7Bwrong%20for%20wrong%2C%20_%2C%20_%20in%20review_fixes()%7D%0A%20%20%20%20mo.vstack(%5B%0A%20%20%20%20%20%20%20%20course.code_view(%5B(line%2C%20any(w%20in%20line%20for%20w%20in%20_wrong))%20for%20line%20in%20agents_code().splitlines()%5D)%2C%0A%20%20%20%20%20%20%20%20mo.md(%22%5Cn%5Cn%22.join(f%22-%20%7Bwhy%7D%22%20for%20_%2C%20_%2C%20why%20in%20review_fixes()))%2C%0A%20%20%20%20%5D)%0A%20%20%20%20return%0A%0A%0A%40app.cell%0Adef%20_()%3A%0A%20%20%20%20%23%20The%20agent's%20detector%20and%20the%20reviewed%20one%2C%20run%20on%20the%20survey%20and%20compared%20with%20the%20planted%20defects%0A%20%20%20%20_scores%20%3D%20pd.DataFrame(%7B%0A%20%20%20%20%20%20%20%20%22as%20the%20agent%20wrote%20it%22%3A%20review_score(detector_from(agents_code())(members%2C%20households%2C%20education))%2C%0A%20%20%20%20%20%20%20%20%22after%20review%22%3A%20review_score(detector_from(reviewed_code())(members%2C%20households%2C%20education))%2C%0A%20%20%20%20%7D)%0A%20%20%20%20_at_16%20%3D%20int(((members%5B%22mem_role_operator%22%5D%20%3D%3D%201)%20%26%20(members%5B%22mem_age%22%5D%20%3D%3D%2016)).sum())%0A%20%20%20%20mo.vstack(%5B%0A%20%20%20%20%20%20%20%20_scores%2C%0A%20%20%20%20%20%20%20%20mo.md(f%22Operators%20aged%20exactly%2016%20in%20this%20survey%3A%20**%7B_at_16%7D**.%20The%20boundary's%20fix%20changes%20a%20figure%20above%20only%20where%20there%20is%20one%3B%20a%20later%20round%20of%20the%20survey%20may%20have%20one.%22)%2C%0A%20%20%20%20%5D)%0A%20%20%20%20return%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_()%3A%0A%20%20%20%20mo.md(r%22%22%22%0A%20%20%20%20Both%20versions%20find%20the%20planted%20households%3B%20that%20line%20is%20what%20an%20agent's%20summary%20would%20quote.%20The%20other%20lines%20are%20what%20a%20supervisor%20pays%20for%2C%20one%20wasted%20look%20at%20a%20time%3A%20rows%20repeated%20by%20the%20join%2C%20children%20flagged%20for%20a%20question%20nobody%20asked%20them%2C%20rows%20in%20households%20with%20no%20defect.%20The%20agent's%20own%20test%20could%20not%20see%20any%20of%20it%2C%20because%20its%20test%20shared%20the%20agent's%20idea%20of%20the%20survey.%20Review%20is%20the%20statistician's%20part%20of%20the%20work%2C%20on%20either%20path.%0A%20%20%20%20%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_()%3A%0A%20%20%20%20mo.md(r%22%22%22%0A%20%20%20%20%23%23%205%20%C2%B7%20The%20local%20demo%2C%20and%20where%20this%20goes%20next%0A%0A%20%20%20%20%23%23%23%20The%20demo%2C%20step%20by%20step%0A%0A%20%20%20%20This%20is%20the%20**trainer's%20demonstration**%3A%20the%20brief%20of%20section%202%20and%20a%20handover%20folder%20go%20to%20an%20open-weight%20model%20on%20the%20trainer's%20own%20computer%2C%20through%20Ollama%20and%20Pi%2C%20and%20nothing%20in%20the%20session%20leaves%20the%20machine.%20A%20self-paced%20learner%20with%20a%20graphics%20card%20can%20follow%20it.%0A%0A%20%20%20%20**Before%20the%20training%20(the%20rehearsal).**%20The%20trainer%20has%20a%20PC%20with%2012%20GB%20of%20graphics%20memory%20and%20a%20laptop%20with%206%20GB.%20Ollama%20listed%20%60qwen3.5%3A9b%60%20at%206.6%E2%80%937.6%20GB%20and%20%60qwen3.5%3A4b%60%20at%203.3%E2%80%934.0%20GB%20(%5BOllama%20library%5D(https%3A%2F%2Follama.com%2Flibrary%2Fqwen3.5)%2C%20checked%20on%209%20November%202026)%2C%20so%20the%20PC's%20candidate%20is%20the%20first%20and%20the%20laptop's%20the%20second.%20The%20context%20window%20needs%20memory%20beside%20the%20model%2C%20so%20the%20rehearsal%20decides%3A%20on%20each%20machine%2C%20run%20the%20steps%20below%2C%20note%20what%20%60ollama%20ps%60%20shows%2C%20and%20count%20how%20many%20of%20the%20brief's%20tests%20the%20model's%20files%20pass.%20Prepare%20the%20project%20folder%20there%20too%3A%20%60AGENTS.md%60%2C%20and%20%60handover%2F%60%20with%20the%20codebook%2C%20the%20code%20lists%2C%20the%20schema%20and%20a%20synthetic%20sample.%20Write%20%60~%2F.pi%2Fagent%2Fmodels.json%60%20by%20hand%3A%0A%0A%20%20%20%20%60%60%60json%0A%20%20%20%20%7B%0A%20%20%20%20%20%20%22providers%22%3A%20%7B%0A%20%20%20%20%20%20%20%20%22ollama%22%3A%20%7B%0A%20%20%20%20%20%20%20%20%20%20%22baseUrl%22%3A%20%22http%3A%2F%2Flocalhost%3A11434%2Fv1%22%2C%0A%20%20%20%20%20%20%20%20%20%20%22api%22%3A%20%22openai-completions%22%2C%0A%20%20%20%20%20%20%20%20%20%20%22apiKey%22%3A%20%22ollama%22%2C%0A%20%20%20%20%20%20%20%20%20%20%22models%22%3A%20%5B%7B%20%22id%22%3A%20%22qwen3.5%3A9b%22%20%7D%5D%0A%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%20%20%7D%0A%20%20%20%20%7D%0A%20%20%20%20%60%60%60%0A%0A%20%20%20%20**In%20the%20room%3A**%0A%0A%20%20%20%201.%20**Say%20what%20is%20about%20to%20happen.**%20The%20same%20brief%2C%20the%20same%20folder%2C%20a%20model%20on%20this%20computer%3B%20nothing%20in%20the%20session%20leaves%20it.%0A%20%20%20%202.%20**Set%20the%20switches%20and%20start%20Ollama**%20(PowerShell%2C%20on%20the%20trainer's%20Windows%20machines)%3A%0A%0A%20%20%20%20%20%20%20%20%60%60%60%0A%20%20%20%20%20%20%20%20%24env%3AOLLAMA_NO_CLOUD%20%3D%20%221%22%0A%20%20%20%20%20%20%20%20%24env%3AOLLAMA_CONTEXT_LENGTH%20%3D%20%2264000%22%0A%20%20%20%20%20%20%20%20%24env%3API_OFFLINE%20%3D%20%221%22%0A%20%20%20%20%20%20%20%20ollama%20serve%0A%20%20%20%20%20%20%20%20%60%60%60%0A%0A%20%20%20%20%20%20%20%20In%20a%20second%20terminal%2C%20%60ollama%20run%20qwen3.5%3A9b%20%22Say%20ready.%22%60%20(the%20laptop%3A%20%60qwen3.5%3A4b%60)%2C%20then%20%60ollama%20ps%60%2C%20and%20show%20the%20room%20how%20much%20of%20the%20model%20sits%20on%20the%20graphics%20card.%0A%20%20%20%203.%20**Show%20the%20folder**%3A%20the%20brief%20and%20the%20handover%20folder%2C%20and%20no%20microdata%3B%20%60git%20status%60%20shows%20a%20clean%20start.%0A%20%20%20%204.%20**Start%20the%20agent%20in%20the%20folder**%3A%20%60pi%20--provider%20ollama%20--model%20qwen3.5%3A9b%60%2C%20and%20give%20it%20one%20line%3A%20*Read%20AGENTS.md%20and%20do%20the%20task.*%20The%20alternative%20driver%20is%20%60codex%20--oss%20-m%20qwen3.5%3A9b%60%2C%20with%20web%20search%20turned%20off.%0A%20%20%20%205.%20**While%20it%20works**%2C%20point%20out%20each%20file%20it%20reads%20and%20each%20command%20it%20runs%3A%20section%201's%20table%2C%20and%20with%20a%20local%20model%20every%20row%20of%20it%20stays%20here.%0A%20%20%20%206.%20**When%20it%20says%20it%20is%20done**%2C%20run%20the%20tests%20yourself%2C%20then%20%60git%20diff%60%2C%20and%20read%20what%20it%20wrote%20with%20section%204's%20review%20list%20in%20hand.%0A%0A%20%20%20%20**If%20it%20is%20slow%20or%20wrong**%2C%20that%20is%20part%20of%20what%20the%20demo%20shows%3A%20the%20review%20is%20the%20same%20whoever%20wrote%20the%20code.%20If%20it%20stalls%2C%20%60ollama%20ps%60%20shows%20whether%20the%20model%20spilled%20to%20the%20processor.%20If%20the%20run%20goes%20nowhere%2C%20show%20the%20rehearsal's%20files%20and%20their%20review%20instead.%0A%0A%20%20%20%20%23%23%23%20What%20a%20full%20training%20on%20agentic%20workflows%20would%20cover%0A%0A%20%20%20%20This%20notebook%20is%20a%20showcase.%20A%20training%20of%20its%20own%20would%20take%20each%20part%20from%20seeing%20to%20doing%2C%20on%20a%20team's%20own%20pipeline%3A%0A%0A%20%20%20%20-%20**Setting%20up%20each%20path**%20on%20the%20institution's%20machines%3A%20a%20cloud%20agent%20under%20the%20institution's%20agreement%2C%20and%20a%20local%20model%20sized%20to%20its%20hardware%2C%20measured%20on%20its%20own%20tasks.%0A%20%20%20%20-%20**Writing%20the%20harness**%3A%20briefs%2C%20handover%20folders%20made%20from%20the%20team's%20own%20codebooks%2C%20synthetic%20samples%20with%20planted%20defects%2C%20tests%20that%20fail%20for%20the%20right%20reason.%0A%20%20%20%20-%20**Configuring%20the%20guards**%20hands-on%3A%20permission%20rules%20and%20modes%2C%20the%20sandbox%2C%20Docker%20Sandboxes%2C%20database%20accounts%2C%20and%20checking%20that%20each%20holds.%0A%20%20%20%20-%20**Reviewing%20agent%20work**%20as%20practice%3A%20finding%20the%20mistakes%20in%20drafted%20rules%2C%20ports%20and%20detectors%2C%20and%20agents%20reviewing%20agents.%0A%20%20%20%20-%20**Language%20models%20on%20the%20data%20itself**%2C%20on%20approved%20local%20machines%3A%20coding%20free%20text%2C%20checking%20names%20against%20codes%2C%20and%20measuring%20how%20often%20the%20model%20is%20right%20before%20anyone%20relies%20on%20it.%0A%20%20%20%20-%20**Governance**%3A%20what%20the%20institution%20approves%20and%20how%2C%20a%20privacy%20impact%20assessment%2C%20and%20who%20reviews%20what%20an%20AI%20system%20produces%2C%20as%20NPC%20Advisory%202024-04%20asks.%0A%0A%20%20%20%20No%20date%20is%20set%20for%20it.%20If%20your%20team%20wants%20it%2C%20tell%20your%20trainer.%0A%20%20%20%20%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_()%3A%0A%20%20%20%20mo.md(r%22%22%22%0A%20%20%20%20%23%23%20What%20you%20can%20do%20now%0A%0A%20%20%20%20%7C%20to%20%7C%20use%20%7C%20and%20check%20%7C%0A%20%20%20%20%7C%3A--%7C%3A--%7C%3A--%7C%0A%20%20%20%20%7C%20say%20what%20a%20session%20sends%20away%20%7C%20the%20agent's%20reads%2C%20commands%20and%20outputs%2C%20and%20where%20its%20model%20runs%20%7C%20a%20model%20with%20%60cloud%60%20in%20its%20name%20is%20not%20local%20%7C%0A%20%20%20%20%7C%20weigh%20cloud%20against%20local%20%7C%20speed%2C%20quality%2C%20cost%2C%20what%20leaves%2C%20reproducibility%2C%20review%20%7C%20the%20institution's%20approval%20for%20anything%20that%20touches%20microdata%20%7C%0A%20%20%20%20%7C%20brief%20an%20agent%20%7C%20%60AGENTS.md%60%20with%20Data%2C%20Task%2C%20Rules%20file%20and%20Tests%20%7C%20a%20brief%20is%20a%20request%3B%20the%20guards%20enforce%20it%20%7C%0A%20%20%20%20%7C%20hand%20over%20what%20it%20needs%20and%20no%20more%20%7C%20the%20codebook%2C%20the%20schema%20and%20a%20synthetic%20sample%20made%20from%20the%20codebook%20%7C%20no%20row%20a%20respondent%20gave%20%7C%0A%20%20%20%20%7C%20limit%20what%20it%20can%20do%20%7C%20permission%20rules%20and%20modes%2C%20the%20sandbox%2C%20Docker%20Sandboxes%2C%20a%20read-only%20account%2C%20%60OLLAMA_NO_CLOUD%3D1%60%20and%20%60PI_OFFLINE%3D1%60%20%7C%20a%20deny%20rule%20stops%20the%20file%20tool%2C%20not%20a%20script%3B%20a%20read-only%20account%20still%20reads%20%7C%0A%20%20%20%20%7C%20review%20what%20it%20wrote%20%7C%20keys%2C%20blanks%2C%20boundaries%20and%20the%20tests'%20own%20data%20%7C%20the%20reviewed%20code%20against%20the%20planted%20defects%2C%20and%20%60git%20diff%60%20%7C%0A%0A%20%20%20%20Next%2C%20the%20capstone%20(%6099_capstone.py%60)%3A%20a%20second%20batch%20of%20the%20survey%20from%20two%20other%20regions%2C%20a%20list%20of%20outputs%20and%20the%20checks%20they%20must%20pass%2C%20and%20no%20code%20given.%20Every%20cell%20your%20group%20runs%20is%20one%20it%20wrote%2C%20with%20an%20agent's%20help%20or%20without.%0A%20%20%20%20%22%22%22)%0A%20%20%20%20return%0A%0A%0Aif%20__name__%20%3D%3D%20%22__main__%22%3A%0A%20%20%20%20app.run()%0A
08a355672766f88e2ff4373e73f78b0a