euron-code 0.7.0__tar.gz → 0.9.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (111) hide show
  1. {euron_code-0.7.0 → euron_code-0.9.0}/CHANGELOG.md +42 -0
  2. {euron_code-0.7.0 → euron_code-0.9.0}/PKG-INFO +47 -11
  3. {euron_code-0.7.0 → euron_code-0.9.0}/README.md +46 -10
  4. {euron_code-0.7.0 → euron_code-0.9.0}/pyproject.toml +1 -1
  5. {euron_code-0.7.0 → euron_code-0.9.0}/src/euron_code/__init__.py +1 -1
  6. {euron_code-0.7.0 → euron_code-0.9.0}/src/euron_code/agent.py +162 -12
  7. {euron_code-0.7.0 → euron_code-0.9.0}/src/euron_code/cli.py +26 -12
  8. euron_code-0.9.0/src/euron_code/knowledge.py +544 -0
  9. euron_code-0.9.0/src/euron_code/logo.py +45 -0
  10. {euron_code-0.7.0 → euron_code-0.9.0}/src/euron_code/project_setup.py +15 -10
  11. {euron_code-0.7.0 → euron_code-0.9.0}/src/euron_code/prompts.py +9 -0
  12. {euron_code-0.7.0 → euron_code-0.9.0}/src/euron_code/repl.py +43 -0
  13. euron_code-0.9.0/src/euron_code/security_scan.py +494 -0
  14. {euron_code-0.7.0 → euron_code-0.9.0}/src/euron_code/tools/erie.py +95 -2
  15. euron_code-0.9.0/tests/test_knowledge_security.py +215 -0
  16. euron_code-0.9.0/tests/test_reuse_honesty.py +113 -0
  17. {euron_code-0.7.0 → euron_code-0.9.0}/tests/test_v5.py +2 -1
  18. {euron_code-0.7.0 → euron_code-0.9.0}/.gitignore +0 -0
  19. {euron_code-0.7.0 → euron_code-0.9.0}/LICENSE +0 -0
  20. {euron_code-0.7.0 → euron_code-0.9.0}/src/euron_code/__main__.py +0 -0
  21. {euron_code-0.7.0 → euron_code-0.9.0}/src/euron_code/activity.py +0 -0
  22. {euron_code-0.7.0 → euron_code-0.9.0}/src/euron_code/api.py +0 -0
  23. {euron_code-0.7.0 → euron_code-0.9.0}/src/euron_code/attachments.py +0 -0
  24. {euron_code-0.7.0 → euron_code-0.9.0}/src/euron_code/auth.py +0 -0
  25. {euron_code-0.7.0 → euron_code-0.9.0}/src/euron_code/builtin_skills/build-from-reference/SKILL.md +0 -0
  26. {euron_code-0.7.0 → euron_code-0.9.0}/src/euron_code/builtin_skills/explain-codebase/SKILL.md +0 -0
  27. {euron_code-0.7.0 → euron_code-0.9.0}/src/euron_code/builtin_skills/review/SKILL.md +0 -0
  28. {euron_code-0.7.0 → euron_code-0.9.0}/src/euron_code/builtin_skills/test-writer/SKILL.md +0 -0
  29. {euron_code-0.7.0 → euron_code-0.9.0}/src/euron_code/cache.py +0 -0
  30. {euron_code-0.7.0 → euron_code-0.9.0}/src/euron_code/checkpoints.py +0 -0
  31. {euron_code-0.7.0 → euron_code-0.9.0}/src/euron_code/config.py +0 -0
  32. {euron_code-0.7.0 → euron_code-0.9.0}/src/euron_code/context.py +0 -0
  33. {euron_code-0.7.0 → euron_code-0.9.0}/src/euron_code/contextforge/LICENSE +0 -0
  34. {euron_code-0.7.0 → euron_code-0.9.0}/src/euron_code/contextforge/__init__.py +0 -0
  35. {euron_code-0.7.0 → euron_code-0.9.0}/src/euron_code/contextforge/text.py +0 -0
  36. {euron_code-0.7.0 → euron_code-0.9.0}/src/euron_code/contextforge/toolout.py +0 -0
  37. {euron_code-0.7.0 → euron_code-0.9.0}/src/euron_code/credentials.py +0 -0
  38. {euron_code-0.7.0 → euron_code-0.9.0}/src/euron_code/doctor.py +0 -0
  39. {euron_code-0.7.0 → euron_code-0.9.0}/src/euron_code/documents.py +0 -0
  40. {euron_code-0.7.0 → euron_code-0.9.0}/src/euron_code/error_hints.py +0 -0
  41. {euron_code-0.7.0 → euron_code-0.9.0}/src/euron_code/errorlog.py +0 -0
  42. {euron_code-0.7.0 → euron_code-0.9.0}/src/euron_code/frontmatter.py +0 -0
  43. {euron_code-0.7.0 → euron_code-0.9.0}/src/euron_code/hooks.py +0 -0
  44. {euron_code-0.7.0 → euron_code-0.9.0}/src/euron_code/keys.py +0 -0
  45. {euron_code-0.7.0 → euron_code-0.9.0}/src/euron_code/licensing.py +0 -0
  46. {euron_code-0.7.0 → euron_code-0.9.0}/src/euron_code/markdown_view.py +0 -0
  47. {euron_code-0.7.0 → euron_code-0.9.0}/src/euron_code/memory.py +0 -0
  48. {euron_code-0.7.0 → euron_code-0.9.0}/src/euron_code/osscache.py +0 -0
  49. {euron_code-0.7.0 → euron_code-0.9.0}/src/euron_code/ossgithub.py +0 -0
  50. {euron_code-0.7.0 → euron_code-0.9.0}/src/euron_code/permissions.py +0 -0
  51. {euron_code-0.7.0 → euron_code-0.9.0}/src/euron_code/repomap.py +0 -0
  52. {euron_code-0.7.0 → euron_code-0.9.0}/src/euron_code/rules.py +0 -0
  53. {euron_code-0.7.0 → euron_code-0.9.0}/src/euron_code/sessions.py +0 -0
  54. {euron_code-0.7.0 → euron_code-0.9.0}/src/euron_code/skills.py +0 -0
  55. {euron_code-0.7.0 → euron_code-0.9.0}/src/euron_code/textsafe.py +0 -0
  56. {euron_code-0.7.0 → euron_code-0.9.0}/src/euron_code/tools/__init__.py +0 -0
  57. {euron_code-0.7.0 → euron_code-0.9.0}/src/euron_code/tools/background.py +0 -0
  58. {euron_code-0.7.0 → euron_code-0.9.0}/src/euron_code/tools/base.py +0 -0
  59. {euron_code-0.7.0 → euron_code-0.9.0}/src/euron_code/tools/db.py +0 -0
  60. {euron_code-0.7.0 → euron_code-0.9.0}/src/euron_code/tools/document.py +0 -0
  61. {euron_code-0.7.0 → euron_code-0.9.0}/src/euron_code/tools/fs.py +0 -0
  62. {euron_code-0.7.0 → euron_code-0.9.0}/src/euron_code/tools/ignore.py +0 -0
  63. {euron_code-0.7.0 → euron_code-0.9.0}/src/euron_code/tools/oss.py +0 -0
  64. {euron_code-0.7.0 → euron_code-0.9.0}/src/euron_code/tools/reuse.py +0 -0
  65. {euron_code-0.7.0 → euron_code-0.9.0}/src/euron_code/tools/search.py +0 -0
  66. {euron_code-0.7.0 → euron_code-0.9.0}/src/euron_code/tools/shell.py +0 -0
  67. {euron_code-0.7.0 → euron_code-0.9.0}/src/euron_code/tools/skill.py +0 -0
  68. {euron_code-0.7.0 → euron_code-0.9.0}/src/euron_code/tools/symbols.py +0 -0
  69. {euron_code-0.7.0 → euron_code-0.9.0}/src/euron_code/tools/task.py +0 -0
  70. {euron_code-0.7.0 → euron_code-0.9.0}/src/euron_code/tools/todo.py +0 -0
  71. {euron_code-0.7.0 → euron_code-0.9.0}/src/euron_code/tools/web.py +0 -0
  72. {euron_code-0.7.0 → euron_code-0.9.0}/src/euron_code/transcript.py +0 -0
  73. {euron_code-0.7.0 → euron_code-0.9.0}/src/euron_code/trust.py +0 -0
  74. {euron_code-0.7.0 → euron_code-0.9.0}/src/euron_code/ui.py +0 -0
  75. {euron_code-0.7.0 → euron_code-0.9.0}/src/euron_code/usage_view.py +0 -0
  76. {euron_code-0.7.0 → euron_code-0.9.0}/tests/conftest.py +0 -0
  77. {euron_code-0.7.0 → euron_code-0.9.0}/tests/helpers.py +0 -0
  78. {euron_code-0.7.0 → euron_code-0.9.0}/tests/mock_gateway.py +0 -0
  79. {euron_code-0.7.0 → euron_code-0.9.0}/tests/serve_helper.py +0 -0
  80. {euron_code-0.7.0 → euron_code-0.9.0}/tests/test_agent_mock.py +0 -0
  81. {euron_code-0.7.0 → euron_code-0.9.0}/tests/test_api_shell.py +0 -0
  82. {euron_code-0.7.0 → euron_code-0.9.0}/tests/test_bench.py +0 -0
  83. {euron_code-0.7.0 → euron_code-0.9.0}/tests/test_cli_e2e.py +0 -0
  84. {euron_code-0.7.0 → euron_code-0.9.0}/tests/test_context_memory_sessions.py +0 -0
  85. {euron_code-0.7.0 → euron_code-0.9.0}/tests/test_db.py +0 -0
  86. {euron_code-0.7.0 → euron_code-0.9.0}/tests/test_erie.py +0 -0
  87. {euron_code-0.7.0 → euron_code-0.9.0}/tests/test_markdown_view.py +0 -0
  88. {euron_code-0.7.0 → euron_code-0.9.0}/tests/test_oss_local.py +0 -0
  89. {euron_code-0.7.0 → euron_code-0.9.0}/tests/test_permissions.py +0 -0
  90. {euron_code-0.7.0 → euron_code-0.9.0}/tests/test_powershell_exit_codes.py +0 -0
  91. {euron_code-0.7.0 → euron_code-0.9.0}/tests/test_qa_attach_secrets.py +0 -0
  92. {euron_code-0.7.0 → euron_code-0.9.0}/tests/test_qa_long_task.py +0 -0
  93. {euron_code-0.7.0 → euron_code-0.9.0}/tests/test_qa_print_output.py +0 -0
  94. {euron_code-0.7.0 → euron_code-0.9.0}/tests/test_qa_reuse_unrelated.py +0 -0
  95. {euron_code-0.7.0 → euron_code-0.9.0}/tests/test_qa_yolo_outside.py +0 -0
  96. {euron_code-0.7.0 → euron_code-0.9.0}/tests/test_repl.py +0 -0
  97. {euron_code-0.7.0 → euron_code-0.9.0}/tests/test_search.py +0 -0
  98. {euron_code-0.7.0 → euron_code-0.9.0}/tests/test_textsafe.py +0 -0
  99. {euron_code-0.7.0 → euron_code-0.9.0}/tests/test_tools_fs.py +0 -0
  100. {euron_code-0.7.0 → euron_code-0.9.0}/tests/test_transcript_ui.py +0 -0
  101. {euron_code-0.7.0 → euron_code-0.9.0}/tests/test_v2_rules_skills_hooks.py +0 -0
  102. {euron_code-0.7.0 → euron_code-0.9.0}/tests/test_v2_tokens_shortcuts.py +0 -0
  103. {euron_code-0.7.0 → euron_code-0.9.0}/tests/test_v2_usage_headers.py +0 -0
  104. {euron_code-0.7.0 → euron_code-0.9.0}/tests/test_v31_security.py +0 -0
  105. {euron_code-0.7.0 → euron_code-0.9.0}/tests/test_v3_accounts_value_setup.py +0 -0
  106. {euron_code-0.7.0 → euron_code-0.9.0}/tests/test_v3_activity.py +0 -0
  107. {euron_code-0.7.0 → euron_code-0.9.0}/tests/test_v3_attachments.py +0 -0
  108. {euron_code-0.7.0 → euron_code-0.9.0}/tests/test_v3_context.py +0 -0
  109. {euron_code-0.7.0 → euron_code-0.9.0}/tests/test_v3_live_repl.py +0 -0
  110. {euron_code-0.7.0 → euron_code-0.9.0}/tests/test_v3_single_login.py +0 -0
  111. {euron_code-0.7.0 → euron_code-0.9.0}/tests/test_v4.py +0 -0
@@ -1,5 +1,47 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.9.0 (2026-11-06)
4
+
5
+ Every build starts from code that already exists, and the report says what was really reused.
6
+
7
+ - Any "build / create / make a <thing>" is now a build request (a scientific calculator, a snake game, an
8
+ expense splitter...), not only the product words Euron Code knew. Small units (a function, a test, a
9
+ regex) are still written directly.
10
+ - Every build request now searches GitHub from your computer for projects that already do it, keeps the
11
+ permissively licensed ones (MIT, Apache-2.0, BSD...), and tells the AI to fetch the best one, read it,
12
+ adopt or adapt it with its licence, and write only what is missing. If the AI still writes everything
13
+ itself without opening any of them, it is asked once to look before it finishes.
14
+ - Honest reuse report: a file only counts as reused when its code is in your project (adopted, credited
15
+ in THIRD_PARTY_NOTICES.md, or a real share of its lines in the files that changed). Files that were
16
+ only read are listed as "Read for reference". The report and the journal show about how many tokens
17
+ of proven code were reused instead of written.
18
+ - The journal (`.euron/knowledge/journal.md`) records what was reused, from where, and the tokens saved;
19
+ "Reused: nothing (written from scratch)" when that is what happened. Asked about it, the AI now reads
20
+ these files instead of saying `.euron` was not changed.
21
+ - The Euron logo greets you when Euron Code starts.
22
+
23
+ ## 0.8.0 (2026-11-06)
24
+
25
+ Euron Code learns each project and keeps a security assessment, on your computer.
26
+
27
+ - First run in a folder or a fresh clone: the project is set up automatically (no question), the code
28
+ is analysed into `.euron/knowledge/codemap.md`, and a day-zero security scan writes
29
+ `.euron/security/assessment.md`. Locally, no tokens.
30
+ - After every task: a journal entry (`.euron/knowledge/journal.md`), the files it built
31
+ (`built.json`), learned rules (`.euron/rules/learned.md`: test, lint and build commands that work,
32
+ commands that keep failing, security lessons) and a rescan of the changed files. New findings are
33
+ shown right away; resolved ones are marked resolved.
34
+ - Every session starts with a compact summary of all this in the context (about 1.5k tokens), so the
35
+ AI stops re-exploring the repository.
36
+ - 23 security checks: secrets and API keys, SQL built from strings, eval / new Function, shell injection,
37
+ unsafe deserialisation, yaml.load, TLS verification off, unverified JWTs, CORS `*`, debug mode,
38
+ insecure cookies, XSS sinks, open redirects, path traversal, weak hashes, insecure randomness, and
39
+ secrets files that git would commit. Secrets are never written to the report. Accept a line with
40
+ `euron: ignore-security`.
41
+ - A `.gitignore` for the stack when there is none; an existing one only gets the missing essentials.
42
+ - New: `/security`, `/security-review`, `/knowledge`. `EURON_NO_AUTOSETUP=1` and `EURON_NO_KNOWLEDGE=1`
43
+ opt out.
44
+
3
45
  ## 0.7.0 (2026-11-06)
4
46
 
5
47
  Answers are formatted, not raw Markdown.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: euron-code
3
- Version: 0.7.0
3
+ Version: 0.9.0
4
4
  Summary: Euron Code: an agentic coding assistant in your terminal for Euron Plus and Super 30 students.
5
5
  Project-URL: Homepage, https://euron.one/code-agent
6
6
  Author-email: Euron <contact@euron.one>
@@ -135,10 +135,29 @@ https://euron.one/code-agent/usage.
135
135
 
136
136
  ## What happens automatically
137
137
 
138
- - **Project setup.** The first time in a folder it writes `EURON.md` (your stack, build and test
139
- commands, layout), rules for your stack, handy commands (`/fix-tests`, `/commit`, `/pr`) and safe
140
- permission settings. Locally, in a second, no AI call. Edit the files freely; `/init` lets the AI
141
- improve `EURON.md`.
138
+ - **Project setup.** The first time in a folder (or a fresh clone) it sets the project up by itself:
139
+ `EURON.md` (your stack, build and test commands, layout), rules for your stack (testing, git,
140
+ security), handy commands (`/fix-tests`, `/commit`, `/pr`, `/security-review`), safe permission
141
+ settings and a `.gitignore` for your stack (only the missing essentials are added to an existing one).
142
+ Locally, in a second, no AI call. Edit the files freely; `/init` lets the AI improve `EURON.md`.
143
+ - **It learns the project, and keeps learning.** On the first run it analyses the code into
144
+ `.euron/knowledge/codemap.md`: what each source file is for, routes, the environment variables the
145
+ code reads, tests, config and CI. After every task it adds to `.euron/knowledge/journal.md` (what was
146
+ asked, files changed, commands and whether they passed), remembers every file it built in
147
+ `built.json`, and rewrites `.euron/rules/learned.md` with what works here (the test, lint and build
148
+ commands that pass, commands that keep failing, security lessons). A compact summary of all of it
149
+ goes into every new session, so Euron Code starts from what it already knows instead of exploring the
150
+ repository again: less time, less context, fewer tokens. The code map refreshes itself when the code
151
+ moves on (a `git pull`, many changed files).
152
+ - **Security assessment from day zero.** On the first run it checks the whole project on your computer
153
+ for common vulnerabilities (secrets and API keys in code, SQL built from strings, eval, shell
154
+ injection, unsafe deserialisation, TLS checks turned off, unverified JWTs, open CORS, XSS sinks, weak
155
+ hashes, secrets files git would commit, and more), then rescans every file it changes after each
156
+ task, and the files changed outside it when a session starts. Every finding, with what to do about
157
+ it, is kept in `.euron/security/assessment.md`, together with what was resolved and a log of every
158
+ scan. New findings are shown as soon as they appear, and the open ones are part of the context, so the
159
+ AI fixes them when it touches those files and does not add new ones. `/security` rescans,
160
+ `/security-review` fixes them. Accept a line as safe with an `euron: ignore-security` comment.
142
161
  - **Context management.** Old tool output is cleared and long conversations are summarised before
143
162
  they fill the context, so it never runs out mid-task. Long answers continue by themselves.
144
163
  - **Token saving.** Unchanged files are not re-read and big files are read in parts.
@@ -146,7 +165,8 @@ https://euron.one/code-agent/usage.
146
165
  Safe to delete; never holds secrets; git-ignored.
147
166
  - **Runs your app.** It can start your dev server in the background, check it answers
148
167
  (`check_app`, optionally in a headless browser), read its logs and stop it again.
149
- - **Builds from references, not from scratch.** For "build me X" and for UI work it first searches
168
+ - **Builds from references, not from scratch.** Every build request first searches GitHub from your computer for permissively licensed projects that already do it, and the AI starts from the best one. The report after each task says what was really reused (code now in your project), what was only read, and about how many tokens that saved.
169
+ - **Reuse first, also from Euron.** For "build me X" and for UI work it first searches
150
170
  Euron's open-source repos, then permissively licensed projects on GitHub, reads only the files it needs,
151
171
  adapts them (keeping the licence notice and recording each source in `THIRD_PARTY_NOTICES.md`) and
152
172
  writes only what is missing. Faster, and far fewer tokens. Try `/reference <what you want to build>`.
@@ -340,6 +360,8 @@ Optional extras: `pip install "euron-code[images]"` (image resizing, clipboard),
340
360
  | `/skills`, `/skills new <name>` | list skills and commands, create a skill |
341
361
  | `/hooks`, `/hooks new`, `/hooks enable` | list hooks, add an example, enable the set-up examples |
342
362
  | `/review [focus]`, `/plan` | review uncommitted changes; plan mode |
363
+ | `/security`, `/security-review` | rescan the project and list open findings; let the AI fix them |
364
+ | `/knowledge` | rebuild the code map and show what goes into the context |
343
365
  | `/permissions` | rules and mode; `/permissions mode acceptEdits`, `/permissions allow "Bash(pytest:*)"` |
344
366
  | `/config` | show settings; `/config set <key> <value> [--project]` |
345
367
  | `/thinking show\|collapse\|hide`, `/todos`, `/doctor` | reasoning display, task list, setup check |
@@ -370,19 +392,33 @@ euron --resume # choose from a list (or /resume inside a session)
370
392
 
371
393
  ### Project setup
372
394
 
373
- `euron init` (or `euron --yes`, or Enter at the first-run question) creates, without overwriting
374
- anything that exists:
395
+ The first interactive run in a new folder (or `euron init`, or `euron -p --yes`) creates, without
396
+ overwriting anything that exists:
375
397
 
376
398
  ```
377
399
  EURON.md stack, commands, layout, entry points
378
400
  .euron/rules/ testing.md, git.md, security.md + python.md / node.md / go.md / rust.md
379
401
  .euron/settings.json allow rules for your test and lint commands and read-only git
380
402
  .euron/hooks.example.json example hooks, OFF until you run /hooks enable
381
- .euron/commands/ /fix-tests, /commit, /pr
382
- .gitignore + .euron/cache/ and .euron/settings.local.json
403
+ .euron/commands/ /fix-tests, /commit, /pr, /security-review
404
+ .gitignore for your stack (secrets, build output, Euron's local data); an existing
405
+ one only gets the missing essentials
383
406
  ```
384
407
 
385
- It is not offered in your home folder or a drive root, and a "no" is remembered.
408
+ and then, every session and after every task, keeps up to date:
409
+
410
+ ```
411
+ .euron/knowledge/codemap.md what the code is: files and their purpose, routes, env var names, tests
412
+ .euron/knowledge/journal.md every task: request, files, commands (pass/fail), result
413
+ .euron/knowledge/built.json every file Euron Code created or changed, and by which tasks
414
+ .euron/rules/learned.md what works in this project, and security lessons
415
+ .euron/security/assessment.md open and resolved findings since day zero, and the scan log
416
+ ```
417
+
418
+ `.euron/knowledge/` and `.euron/security/` stay on your computer (git-ignored): they hold your prompts
419
+ and the open findings. Rules, commands and `EURON.md` are meant to be committed. Never in your home
420
+ folder or a drive root. Set `EURON_NO_AUTOSETUP=1` to be asked with `euron init` instead, or
421
+ `EURON_NO_KNOWLEDGE=1` to turn the project memory and security checks off.
386
422
 
387
423
  ## Memory: EURON.md
388
424
 
@@ -69,10 +69,29 @@ https://euron.one/code-agent/usage.
69
69
 
70
70
  ## What happens automatically
71
71
 
72
- - **Project setup.** The first time in a folder it writes `EURON.md` (your stack, build and test
73
- commands, layout), rules for your stack, handy commands (`/fix-tests`, `/commit`, `/pr`) and safe
74
- permission settings. Locally, in a second, no AI call. Edit the files freely; `/init` lets the AI
75
- improve `EURON.md`.
72
+ - **Project setup.** The first time in a folder (or a fresh clone) it sets the project up by itself:
73
+ `EURON.md` (your stack, build and test commands, layout), rules for your stack (testing, git,
74
+ security), handy commands (`/fix-tests`, `/commit`, `/pr`, `/security-review`), safe permission
75
+ settings and a `.gitignore` for your stack (only the missing essentials are added to an existing one).
76
+ Locally, in a second, no AI call. Edit the files freely; `/init` lets the AI improve `EURON.md`.
77
+ - **It learns the project, and keeps learning.** On the first run it analyses the code into
78
+ `.euron/knowledge/codemap.md`: what each source file is for, routes, the environment variables the
79
+ code reads, tests, config and CI. After every task it adds to `.euron/knowledge/journal.md` (what was
80
+ asked, files changed, commands and whether they passed), remembers every file it built in
81
+ `built.json`, and rewrites `.euron/rules/learned.md` with what works here (the test, lint and build
82
+ commands that pass, commands that keep failing, security lessons). A compact summary of all of it
83
+ goes into every new session, so Euron Code starts from what it already knows instead of exploring the
84
+ repository again: less time, less context, fewer tokens. The code map refreshes itself when the code
85
+ moves on (a `git pull`, many changed files).
86
+ - **Security assessment from day zero.** On the first run it checks the whole project on your computer
87
+ for common vulnerabilities (secrets and API keys in code, SQL built from strings, eval, shell
88
+ injection, unsafe deserialisation, TLS checks turned off, unverified JWTs, open CORS, XSS sinks, weak
89
+ hashes, secrets files git would commit, and more), then rescans every file it changes after each
90
+ task, and the files changed outside it when a session starts. Every finding, with what to do about
91
+ it, is kept in `.euron/security/assessment.md`, together with what was resolved and a log of every
92
+ scan. New findings are shown as soon as they appear, and the open ones are part of the context, so the
93
+ AI fixes them when it touches those files and does not add new ones. `/security` rescans,
94
+ `/security-review` fixes them. Accept a line as safe with an `euron: ignore-security` comment.
76
95
  - **Context management.** Old tool output is cleared and long conversations are summarised before
77
96
  they fill the context, so it never runs out mid-task. Long answers continue by themselves.
78
97
  - **Token saving.** Unchanged files are not re-read and big files are read in parts.
@@ -80,7 +99,8 @@ https://euron.one/code-agent/usage.
80
99
  Safe to delete; never holds secrets; git-ignored.
81
100
  - **Runs your app.** It can start your dev server in the background, check it answers
82
101
  (`check_app`, optionally in a headless browser), read its logs and stop it again.
83
- - **Builds from references, not from scratch.** For "build me X" and for UI work it first searches
102
+ - **Builds from references, not from scratch.** Every build request first searches GitHub from your computer for permissively licensed projects that already do it, and the AI starts from the best one. The report after each task says what was really reused (code now in your project), what was only read, and about how many tokens that saved.
103
+ - **Reuse first, also from Euron.** For "build me X" and for UI work it first searches
84
104
  Euron's open-source repos, then permissively licensed projects on GitHub, reads only the files it needs,
85
105
  adapts them (keeping the licence notice and recording each source in `THIRD_PARTY_NOTICES.md`) and
86
106
  writes only what is missing. Faster, and far fewer tokens. Try `/reference <what you want to build>`.
@@ -274,6 +294,8 @@ Optional extras: `pip install "euron-code[images]"` (image resizing, clipboard),
274
294
  | `/skills`, `/skills new <name>` | list skills and commands, create a skill |
275
295
  | `/hooks`, `/hooks new`, `/hooks enable` | list hooks, add an example, enable the set-up examples |
276
296
  | `/review [focus]`, `/plan` | review uncommitted changes; plan mode |
297
+ | `/security`, `/security-review` | rescan the project and list open findings; let the AI fix them |
298
+ | `/knowledge` | rebuild the code map and show what goes into the context |
277
299
  | `/permissions` | rules and mode; `/permissions mode acceptEdits`, `/permissions allow "Bash(pytest:*)"` |
278
300
  | `/config` | show settings; `/config set <key> <value> [--project]` |
279
301
  | `/thinking show\|collapse\|hide`, `/todos`, `/doctor` | reasoning display, task list, setup check |
@@ -304,19 +326,33 @@ euron --resume # choose from a list (or /resume inside a session)
304
326
 
305
327
  ### Project setup
306
328
 
307
- `euron init` (or `euron --yes`, or Enter at the first-run question) creates, without overwriting
308
- anything that exists:
329
+ The first interactive run in a new folder (or `euron init`, or `euron -p --yes`) creates, without
330
+ overwriting anything that exists:
309
331
 
310
332
  ```
311
333
  EURON.md stack, commands, layout, entry points
312
334
  .euron/rules/ testing.md, git.md, security.md + python.md / node.md / go.md / rust.md
313
335
  .euron/settings.json allow rules for your test and lint commands and read-only git
314
336
  .euron/hooks.example.json example hooks, OFF until you run /hooks enable
315
- .euron/commands/ /fix-tests, /commit, /pr
316
- .gitignore + .euron/cache/ and .euron/settings.local.json
337
+ .euron/commands/ /fix-tests, /commit, /pr, /security-review
338
+ .gitignore for your stack (secrets, build output, Euron's local data); an existing
339
+ one only gets the missing essentials
317
340
  ```
318
341
 
319
- It is not offered in your home folder or a drive root, and a "no" is remembered.
342
+ and then, every session and after every task, keeps up to date:
343
+
344
+ ```
345
+ .euron/knowledge/codemap.md what the code is: files and their purpose, routes, env var names, tests
346
+ .euron/knowledge/journal.md every task: request, files, commands (pass/fail), result
347
+ .euron/knowledge/built.json every file Euron Code created or changed, and by which tasks
348
+ .euron/rules/learned.md what works in this project, and security lessons
349
+ .euron/security/assessment.md open and resolved findings since day zero, and the scan log
350
+ ```
351
+
352
+ `.euron/knowledge/` and `.euron/security/` stay on your computer (git-ignored): they hold your prompts
353
+ and the open findings. Rules, commands and `EURON.md` are meant to be committed. Never in your home
354
+ folder or a drive root. Set `EURON_NO_AUTOSETUP=1` to be asked with `euron init` instead, or
355
+ `EURON_NO_KNOWLEDGE=1` to turn the project memory and security checks off.
320
356
 
321
357
  ## Memory: EURON.md
322
358
 
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "euron-code"
7
- version = "0.7.0"
7
+ version = "0.9.0"
8
8
  description = "Euron Code: an agentic coding assistant in your terminal for Euron Plus and Super 30 students."
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.9"
@@ -1,3 +1,3 @@
1
1
  """Euron Code: an agentic coding assistant for the terminal."""
2
2
 
3
- __version__ = "0.7.0"
3
+ __version__ = "0.9.0"
@@ -16,9 +16,9 @@ import time
16
16
  import uuid
17
17
  from dataclasses import dataclass, field
18
18
  from pathlib import Path
19
- from typing import Any, Callable, Dict, List, Optional
19
+ from typing import Any, Callable, Dict, List, Optional, Tuple
20
20
 
21
- from euron_code import api, context, memory, prompts, rules, skills
21
+ from euron_code import api, context, licensing, memory, prompts, rules, skills
22
22
  from euron_code.activity import Activity, phase_from_comment, tool_label
23
23
  from euron_code.api import (BusyError, ContextTooLongError, EuronError, Interrupted, MidStreamError,
24
24
  NetworkError, RateLimitedError)
@@ -47,6 +47,7 @@ REPEAT_STOP_AT = 8
47
47
  SEARCH_BUDGET = 4 # reference searches per request before a "pick one" note
48
48
  READ_BUDGET = 6 # reference file reads per request
49
49
  SEARCH_TOOLS = ("euron_reuse_search", "oss_search")
50
+ _GUTTER_RE = re.compile(r"^\s*\d+\s*[|:\u2502\t]\s?")
50
51
  READ_TOOLS = ("euron_reuse_read", "oss_read", "oss_tree", "oss_grep")
51
52
  _LIC_RE = re.compile(r"\[(MIT|Apache-2\.0|BSD-[23]-Clause|ISC|0BSD|Unlicense|MPL-2\.0|CC0-1\.0|Zlib)\]|licence (\S+)")
52
53
  DEFAULT_STEP_BUDGET = 60
@@ -182,7 +183,11 @@ class Agent:
182
183
  self.on_session_in_use: Optional[Callable[[], bool]] = None
183
184
  # step budget reached: return True to allow another budget's worth of steps
184
185
  self.on_step_limit: Optional[Callable[[int], bool]] = None
185
- self.ledger: Dict[str, List[Any]] = {"edits": [], "commands": [], "reused": []} # this prompt's work
186
+ self.ledger: Dict[str, List[Any]] = {"edits": [], "commands": [], "reused": [], "read": []} # this prompt's work
187
+ self._reuse_chars: Dict[Tuple[str, str], int] = {} # (repo, path) -> characters of reused code
188
+ self._read_bodies: Dict[Tuple[str, str], str] = {} # (repo, path) -> text read, for the overlap check
189
+ self._references: List[Dict[str, Any]] = [] # GitHub repos offered for this build request
190
+ self._reuse_nudged = False
186
191
  self._calls: Dict[tuple, int] = {}
187
192
  self._nudged = False
188
193
  self.test_command: Optional[str] = None
@@ -220,9 +225,21 @@ class Agent:
220
225
  rules_text = rules.render_always(self.rules.rules)
221
226
  self.skills = skills.load_skills(self.root)
222
227
  skills_text = skills.render_index(self.skills)
223
- self.system_parts = {"memory": mem, "rules": rules_text, "skills": skills_text}
224
228
  from euron_code import trust
225
229
  self.project_trusted = trust.is_trusted(self.root)
230
+ # What Euron Code already knows about this project (code map, recent work, open security
231
+ # findings), so a task starts from it instead of re-exploring. Built locally; repo-provided
232
+ # content, so only for a trusted project, like EURON.md.
233
+ know = ""
234
+ if self.project_trusted:
235
+ try:
236
+ from euron_code import knowledge
237
+ know = knowledge.render(self.root)
238
+ except Exception:
239
+ know = ""
240
+ if know:
241
+ mem = (mem + "\n\n" + know) if mem else know
242
+ self.system_parts = {"memory": mem, "rules": rules_text, "skills": skills_text, "knowledge": know}
226
243
  return prompts.build_system_prompt(self.root, self.shell_kind, mem, rules_text=rules_text,
227
244
  skills_text=skills_text,
228
245
  extra_dirs=getattr(self.permissions, "extra_roots", ()),
@@ -312,7 +329,11 @@ class Agent:
312
329
 
313
330
  def _run_top_turn(self, user_text: str, max_turns: Optional[int]) -> TurnResult:
314
331
  self.client.task_id = api.new_task_id() # X-Euron-Task: one per user prompt
315
- self.ledger = {"edits": [], "commands": [], "reused": []}
332
+ self.ledger = {"edits": [], "commands": [], "reused": [], "read": []}
333
+ self._reuse_chars = {}
334
+ self._read_bodies = {}
335
+ self._references = []
336
+ self._reuse_nudged = False
316
337
  self._calls = {}
317
338
  self.plan = None
318
339
  self._reused_components = {}
@@ -329,10 +350,44 @@ class Agent:
329
350
  if r.code == 0 and r.stdout.strip():
330
351
  self.add_context(hook_block("UserPromptSubmit", r.stdout))
331
352
  self.checkpoints.begin(len(self.messages), user_text)
353
+ result: Optional[TurnResult] = None
332
354
  try:
333
- return self._run_turn(user_text, max_turns)
355
+ result = self._run_turn(user_text, max_turns)
356
+ return result
334
357
  finally:
335
358
  self.checkpoints.finish()
359
+ self._remember_task(user_text, result)
360
+
361
+ def _remember_task(self, user_text: str, result: Optional[TurnResult]) -> None:
362
+ """After every task: rescan the files it changed for security issues, then add it to the
363
+ project's journal, the built-files cache and the learned rules (.euron/knowledge/). Local,
364
+ quick, and never allowed to break the session."""
365
+ from euron_code import knowledge, security_scan
366
+ if not knowledge.enabled() or not knowledge.is_set_up(self.root) or not getattr(self, "project_trusted", False):
367
+ return
368
+ try:
369
+ note = ""
370
+ edits = self.files_changed()
371
+ if edits:
372
+ res = security_scan.scan_paths(self.root, edits, "after task: " + " ".join(user_text.split())[:60])
373
+ if res.new:
374
+ worst = res.new[0]
375
+ note = f"{len(res.new)} new finding(s), e.g. {worst['title']} in {worst['file']}:{worst['line']}"
376
+ self.ui.warn(f"Security: {len(res.new)} new finding(s) in the files just changed "
377
+ f"(worst: {worst['severity']} - {worst['title']} at {worst['file']}:{worst['line']}). "
378
+ "See .euron/security/assessment.md or run /security-review.")
379
+ if res.resolved:
380
+ note = (note + "; " if note else "") + f"{len(res.resolved)} finding(s) resolved"
381
+ self.ui.dim(f"Security: {len(res.resolved)} earlier finding(s) resolved by this change.")
382
+ knowledge.record_task(self.root, user_text, self.ledger,
383
+ result.text if result else "", result.stop_reason if result else "error", note,
384
+ saved_tokens=self.reuse_savings())
385
+ except Exception as e:
386
+ try:
387
+ from euron_code import errorlog
388
+ errorlog.get().report("knowledge", "record_failed", str(e)[:300])
389
+ except Exception:
390
+ pass
336
391
 
337
392
  def _run_turn(self, user_text: str, max_turns: Optional[int]) -> TurnResult:
338
393
  max_turns = max_turns or self.max_turns
@@ -470,6 +525,11 @@ class Agent:
470
525
  self._append({"role": "user", "content": prompts.PLACEHOLDER_NUDGE.format(where=where)})
471
526
  self.ui.dim("(asking Euron Code to replace placeholder text with your details)")
472
527
  continue
528
+ if self._needs_reuse_nudge():
529
+ self._reuse_nudged = True
530
+ self._append({"role": "user", "content": prompts.reuse_nudge(self._references)})
531
+ self.ui.dim("(asking Euron Code to start from an existing open-source implementation)")
532
+ continue
473
533
  missing = self._missing_notices() if not self._notice_nudged and not self.is_subagent else ""
474
534
  if missing:
475
535
  self._notice_nudged = True
@@ -885,8 +945,10 @@ class Agent:
885
945
  return plan_entries(self.plan)
886
946
 
887
947
  def _record_reuse(self, name: str, args: Dict[str, Any], content: str) -> str:
888
- """Count reference searches / reads (budget notes) and remember what was read, for the report."""
889
- reused = self.ledger.setdefault("reused", [])
948
+ """Count reference searches / reads (budget notes) and remember what was READ. Reading a file is not
949
+ reusing it: it only counts as reused once it is adopted (oss_adopt) or its repo is credited with
950
+ add_third_party_notice (QA 2026-11-06: "Reused: card.tsx" for a file the model read and rejected)."""
951
+ reused = self.ledger.setdefault("read", [])
890
952
  note = ""
891
953
  if name in SEARCH_TOOLS:
892
954
  n = self._calls[("budget", "search")] = self._calls.get(("budget", "search"), 0) + 1
@@ -902,6 +964,8 @@ class Agent:
902
964
  item = (str(args["repo"]), str(args["path"]), lic)
903
965
  if item not in reused:
904
966
  reused.append(item)
967
+ body = content.split("\n", 2)[-1]
968
+ self._read_bodies[(item[0], item[1])] = body[:200_000]
905
969
  if n >= READ_BUDGET:
906
970
  note = (f"\n\n[Euron Code: {n} reference reads on this request. You have enough: adapt what you "
907
971
  "read, record it with add_third_party_notice, and write only what is missing.]")
@@ -913,10 +977,70 @@ class Agent:
913
977
  m = _LIC_RE.search(content.partition("\n")[0])
914
978
  lic = (m.group(1) or m.group(2)) if m else "?"
915
979
  paths = args.get("paths") if isinstance(args.get("paths"), list) else [args.get("paths")]
916
- for p in paths:
980
+ m2 = re.search(r"\]: (.*?)\. " + re.escape(licensing.NOTICES_FILE), content)
981
+ written = [w.strip() for w in m2.group(1).split(";")] if m2 else []
982
+ for i, p in enumerate(paths):
917
983
  item = (str(args.get("repo")), str(p), lic)
918
984
  if p and item not in reused:
919
985
  reused.append(item)
986
+ if i < len(written):
987
+ try:
988
+ self._reuse_chars[(item[0], item[1])] = (self.root / written[i]).stat().st_size
989
+ except OSError:
990
+ pass
991
+
992
+ def _record_notice(self, args: Dict[str, Any]) -> None:
993
+ """add_third_party_notice credits a repo: the files read from it were adapted, so they count as reused."""
994
+ repo = str(args.get("source") or "").strip().lower()
995
+ if not repo:
996
+ return
997
+ reused = self.ledger.setdefault("reused", [])
998
+ for r, p, lic in self.ledger.get("read") or []:
999
+ if r.lower() == repo and not any((r, p) == (x[0], x[1]) for x in reused):
1000
+ reused.append((r, p, str(args.get("license") or lic)))
1001
+
1002
+ def _settle_reuse(self) -> None:
1003
+ """A file that was read counts as reused when a real part of it is now in the files this prompt
1004
+ changed: at least 5 of its distinctive lines, or 30% of them. Measured, not assumed."""
1005
+ read = self.ledger.get("read") or []
1006
+ if not read:
1007
+ return
1008
+ changed = []
1009
+ for rel in self.files_changed():
1010
+ try:
1011
+ p = self.root / rel
1012
+ if p.is_file() and p.stat().st_size < 1_000_000:
1013
+ changed.append(p.read_text(encoding="utf-8", errors="ignore"))
1014
+ except OSError:
1015
+ continue
1016
+ if not changed:
1017
+ return
1018
+ have = {ln.strip() for text in changed for ln in text.splitlines()}
1019
+ reused = self.ledger.setdefault("reused", [])
1020
+ for item in read:
1021
+ key = (item[0], item[1])
1022
+ credited = any((r, p) == key for r, p, _ in reused) # adopted or credited with a notice
1023
+ if credited and key in self._reuse_chars:
1024
+ continue
1025
+ body = self._read_bodies.get(key, "")
1026
+ lines = set()
1027
+ for ln in body.splitlines():
1028
+ ln = _GUTTER_RE.sub("", ln).strip() # read tools number their lines: " 12 | code"
1029
+ if len(ln) >= 20 and not ln.startswith(("#", "//", "/*", "*")):
1030
+ lines.add(ln)
1031
+ if not lines:
1032
+ continue
1033
+ hits = len(lines & have)
1034
+ if credited:
1035
+ # already reused: measure how much of it is in the project, for the savings figure
1036
+ self._reuse_chars[key] = sum(len(x) for x in lines & have)
1037
+ elif hits >= 5 or hits / len(lines) >= 0.3:
1038
+ reused.append(item)
1039
+ self._reuse_chars[key] = sum(len(x) for x in lines & have)
1040
+
1041
+ def reuse_savings(self) -> int:
1042
+ """About how many output tokens reused code saved: what was copied or adapted did not have to be written."""
1043
+ return sum(self._reuse_chars.get((r, p), 0) for r, p, _ in self.ledger.get("reused") or []) // 4
920
1044
 
921
1045
  def files_changed(self) -> List[str]:
922
1046
  return list(dict.fromkeys(rel for _, rel in self.ledger["edits"]))
@@ -938,6 +1062,13 @@ class Agent:
938
1062
  data = erie.request_plan(self, self.ui, user_text.strip()[:500], comps, erie.external_allowed(self.settings))
939
1063
  out += "\n\n" + (erie.plan_note(data["components"]) if data and data.get("components")
940
1064
  else prompts.BUILD_NOTE)
1065
+ if erie.external_allowed(self.settings):
1066
+ refs = erie.github_references(user_text, self.stack, self.settings)
1067
+ if refs:
1068
+ self._references = refs
1069
+ out += "\n\n" + erie.references_note(refs)
1070
+ self.ui.dim("References on GitHub: " + "; ".join(
1071
+ f"{r['repo']} ({r.get('license') or '?'}, {r.get('stars', 0):,} stars)" for r in refs[:3]))
941
1072
  staged = self._stage_images()
942
1073
  if staged:
943
1074
  out += ("\n\n[The user's image(s) are now in the project: " + ", ".join(staged) +
@@ -976,6 +1107,17 @@ class Agent:
976
1107
  out.append(rel)
977
1108
  return out
978
1109
 
1110
+ def _needs_reuse_nudge(self) -> bool:
1111
+ """Once per build request: references were found on GitHub, but the model wrote everything itself without
1112
+ reading any of them (QA 2026-11-06: a scientific calculator built from scratch, 0 reused, while hundreds
1113
+ of MIT calculators exist)."""
1114
+ if self.is_subagent or self._reuse_nudged or not self._references or self.permissions.mode == "plan":
1115
+ return False
1116
+ if not self.ledger.get("edits"):
1117
+ return False
1118
+ looked = {r.lower() for r, _, _ in (self.ledger.get("read") or []) + (self.ledger.get("reused") or [])}
1119
+ return not any(ref["repo"].lower() in looked for ref in self._references)
1120
+
979
1121
  def _placeholders(self) -> str:
980
1122
  """Placeholder text left in the files changed this prompt ("Your Name", "Lorem ipsum", ...)."""
981
1123
  hits = []
@@ -998,7 +1140,7 @@ class Agent:
998
1140
  THIRD_PARTY_NOTICES.md does not list. QA 2026-11-05: a portfolio's Hero said "Adapted from
999
1141
  euron-sde-team/euron-open-multi-tenant-lms (MIT)" and the notices file had no entry for it."""
1000
1142
  from euron_code import licensing
1001
- repos = list(dict.fromkeys(r for r, _, _ in self.ledger.get("reused") or []))
1143
+ repos = list(dict.fromkeys(r for r, _, _ in (self.ledger.get("reused") or []) + (self.ledger.get("read") or [])))
1002
1144
  if not repos:
1003
1145
  return ""
1004
1146
  try:
@@ -1039,9 +1181,11 @@ class Agent:
1039
1181
 
1040
1182
  def _footer(self) -> None:
1041
1183
  """Local report after a prompt that changed files (shown to the user, not sent to the model)."""
1184
+ self._settle_reuse()
1042
1185
  changed = self.files_changed()
1043
1186
  reused = self.ledger.get("reused") or []
1044
- read_repos = {r for r, _, _ in reused}
1187
+ read_repos = {r for r, _, _ in reused} # the plan line names a repo only when its code is in the project
1188
+ only_read = [x for x in (self.ledger.get("read") or []) if x not in reused]
1045
1189
  # "x reused from repo" only when that repo was actually read (QA 2026-11-05: a question about two
1046
1190
  # attached documents printed "Reuse plan: api reused from euron-open-smart-router" with nothing read)
1047
1191
  planned = [c for c in self.reuse_report() if c["decision"] in ("REUSE", "ADAPT") and c.get("repo") in read_repos]
@@ -1050,7 +1194,11 @@ class Agent:
1050
1194
  self.ui.dim("Reuse plan: " + "; ".join(f"{c['component']} {_PAST.get(c['decision'], c['decision'].lower())} from {c['repo']} "
1051
1195
  f"({c['license']})" for c in planned[:6]))
1052
1196
  if reused:
1053
- self.ui.dim("Reused: " + "; ".join(f"{r}/{p} ({lic})" for r, p, lic in reused[:6]))
1197
+ saved = self.reuse_savings()
1198
+ self.ui.dim("Reused: " + "; ".join(f"{r}/{p} ({lic})" for r, p, lic in reused[:6])
1199
+ + (f" | about {saved:,} tokens of proven code not written from scratch" if saved else ""))
1200
+ if only_read:
1201
+ self.ui.dim("Read for reference (not reused): " + "; ".join(f"{r}/{p}" for r, p, _ in only_read[:4]))
1054
1202
  if not changed:
1055
1203
  return
1056
1204
  cmds = self.ledger["commands"]
@@ -1154,6 +1302,8 @@ class Agent:
1154
1302
  self._record(name, req, content, result.is_error)
1155
1303
  if not result.is_error and name == "oss_adopt":
1156
1304
  self._record_adoption(args, content)
1305
+ if not result.is_error and name == "add_third_party_notice":
1306
+ self._record_notice(args)
1157
1307
  if not result.is_error and (name in SEARCH_TOOLS or name in READ_TOOLS):
1158
1308
  content += self._record_reuse(name, args, content)
1159
1309
  self._note_component_read(name, args)
@@ -379,6 +379,11 @@ def _run_session(args, ui, root, settings) -> int:
379
379
  if args.print_mode or not sys.stdin.isatty():
380
380
  ui.error("You are not logged in. Run `euron login` first.")
381
381
  return EXIT_AUTH
382
+ from euron_code import logo
383
+ ui.plain("")
384
+ for row in logo.lines(ascii=getattr(ui, "ascii", False)):
385
+ ui.plain(" " + row)
386
+ ui.plain("")
382
387
  ui.info("Welcome to Euron Code. First, log in with your Euron account in the browser "
383
388
  "(only once; the key is then saved on this computer).")
384
389
  try:
@@ -415,19 +420,16 @@ def _run_session(args, ui, root, settings) -> int:
415
420
  except api.EuronError as e:
416
421
  return _report(ui, e)
417
422
 
418
- # first run in a new folder: offer the local project setup (no model call)
423
+ # first run in a new folder (or a fresh clone): set the project up automatically, locally and
424
+ # without a model call. `-p` (scripts) only does it with --yes; EURON_NO_AUTOSETUP=1 opts out.
419
425
  from euron_code import project_setup
420
- if project_setup.should_offer(root) and (args.yes or (not args.print_mode and sys.stdin.isatty())):
421
- ans = "y" if args.yes else ui.ask_text(
422
- "Set up this project for Euron Code (EURON.md, rules, commands, settings)? (Y/n) ").strip().lower()
423
- if ans in ("", "y", "yes"):
424
- from euron_code import trust as _trust
425
- with _trust.keep(root):
426
- created = project_setup.setup(root)
427
- show_setup(ui, root, created)
428
- else:
429
- project_setup.remember_declined(root)
430
- ui.dim("Skipped. Run `euron init` any time to set it up.")
426
+ interactive_run = not args.print_mode and sys.stdin.isatty()
427
+ auto = os.environ.get("EURON_NO_AUTOSETUP", "").strip() in ("", "0", "false")
428
+ if project_setup.should_offer(root) and (args.yes or (interactive_run and auto)):
429
+ from euron_code import trust as _trust
430
+ with _trust.keep(root):
431
+ created = project_setup.setup(root)
432
+ show_setup(ui, root, created)
431
433
 
432
434
  # a cloned repo may not loosen anything without the user's trust (trust.py)
433
435
  from euron_code import trust
@@ -436,6 +438,18 @@ def _run_session(args, ui, root, settings) -> int:
436
438
  if settings.get("_ignoredProjectSettings") and not args.print_mode:
437
439
  ui.dim("Ignored (not trusted): " + ", ".join(settings["_ignoredProjectSettings"]))
438
440
 
441
+ # The project's memory: code map on the first run, refreshed when the code moves on, plus the
442
+ # security assessment (day-zero scan, then whatever changed). Local and quick; never blocks.
443
+ if trusted:
444
+ from euron_code import knowledge
445
+ if (not args.print_mode and knowledge.enabled() and knowledge.is_set_up(root)
446
+ and not (knowledge.kdir(root) / knowledge.CODEMAP).exists()):
447
+ ui.dim("First run here: analysing the project and checking it for security issues "
448
+ "(on this computer, no tokens)...")
449
+ for line in knowledge.bootstrap(root, ui, trusted):
450
+ if not args.print_mode:
451
+ ui.dim(line)
452
+
439
453
  model = args.model or settings.get("model") or me.get("defaultModel") or "euron-coder"
440
454
  apply_model_limits(client, settings, model)
441
455
  if getattr(args, "no_reuse", False):