dfm-agent 0.0.1__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 (165) hide show
  1. dfm_agent-0.0.1/.gitignore +19 -0
  2. dfm_agent-0.0.1/CHANGELOG.md +56 -0
  3. dfm_agent-0.0.1/LICENSE +21 -0
  4. dfm_agent-0.0.1/PKG-INFO +112 -0
  5. dfm_agent-0.0.1/README.md +78 -0
  6. dfm_agent-0.0.1/SECURITY.md +43 -0
  7. dfm_agent-0.0.1/dfm/__init__.py +10 -0
  8. dfm_agent-0.0.1/dfm/benchmark/__init__.py +25 -0
  9. dfm_agent-0.0.1/dfm/benchmark/runner.py +379 -0
  10. dfm_agent-0.0.1/dfm/benchmark/tasks.py +385 -0
  11. dfm_agent-0.0.1/dfm/ci/__init__.py +14 -0
  12. dfm_agent-0.0.1/dfm/ci/logs.py +77 -0
  13. dfm_agent-0.0.1/dfm/ci/workflows.py +123 -0
  14. dfm_agent-0.0.1/dfm/cli/__init__.py +1 -0
  15. dfm_agent-0.0.1/dfm/cli/app.py +117 -0
  16. dfm_agent-0.0.1/dfm/cli/ask_cmd.py +64 -0
  17. dfm_agent-0.0.1/dfm/cli/benchmark_cmd.py +104 -0
  18. dfm_agent-0.0.1/dfm/cli/ci_cmd.py +64 -0
  19. dfm_agent-0.0.1/dfm/cli/config_cmd.py +77 -0
  20. dfm_agent-0.0.1/dfm/cli/diff_cmd.py +49 -0
  21. dfm_agent-0.0.1/dfm/cli/doctor_cmd.py +44 -0
  22. dfm_agent-0.0.1/dfm/cli/github_cmd.py +255 -0
  23. dfm_agent-0.0.1/dfm/cli/logs_cmd.py +95 -0
  24. dfm_agent-0.0.1/dfm/cli/memory_cmd.py +79 -0
  25. dfm_agent-0.0.1/dfm/cli/models_cmd.py +184 -0
  26. dfm_agent-0.0.1/dfm/cli/processes_cmd.py +69 -0
  27. dfm_agent-0.0.1/dfm/cli/repo_cmd.py +104 -0
  28. dfm_agent-0.0.1/dfm/cli/review_cmd.py +130 -0
  29. dfm_agent-0.0.1/dfm/cli/services_cmd.py +89 -0
  30. dfm_agent-0.0.1/dfm/cli/sessions_cmd.py +78 -0
  31. dfm_agent-0.0.1/dfm/cli/setup_cmd.py +46 -0
  32. dfm_agent-0.0.1/dfm/cli/status_cmd.py +116 -0
  33. dfm_agent-0.0.1/dfm/cli/work_cmd.py +160 -0
  34. dfm_agent-0.0.1/dfm/config/__init__.py +17 -0
  35. dfm_agent-0.0.1/dfm/config/loader.py +235 -0
  36. dfm_agent-0.0.1/dfm/config/model.py +119 -0
  37. dfm_agent-0.0.1/dfm/config/paths.py +90 -0
  38. dfm_agent-0.0.1/dfm/config/writer.py +77 -0
  39. dfm_agent-0.0.1/dfm/context/__init__.py +12 -0
  40. dfm_agent-0.0.1/dfm/context/engine.py +400 -0
  41. dfm_agent-0.0.1/dfm/docsgen.py +172 -0
  42. dfm_agent-0.0.1/dfm/doctor/__init__.py +5 -0
  43. dfm_agent-0.0.1/dfm/doctor/checks.py +385 -0
  44. dfm_agent-0.0.1/dfm/execution/__init__.py +19 -0
  45. dfm_agent-0.0.1/dfm/execution/environment.py +274 -0
  46. dfm_agent-0.0.1/dfm/integrations/__init__.py +1 -0
  47. dfm_agent-0.0.1/dfm/integrations/base.py +11 -0
  48. dfm_agent-0.0.1/dfm/integrations/github/__init__.py +25 -0
  49. dfm_agent-0.0.1/dfm/integrations/github/client.py +412 -0
  50. dfm_agent-0.0.1/dfm/integrations/reflex/__init__.py +5 -0
  51. dfm_agent-0.0.1/dfm/integrations/reflex/provider.py +221 -0
  52. dfm_agent-0.0.1/dfm/integrations/repocanon/__init__.py +33 -0
  53. dfm_agent-0.0.1/dfm/integrations/repocanon/provider.py +423 -0
  54. dfm_agent-0.0.1/dfm/integrations/repokg/__init__.py +37 -0
  55. dfm_agent-0.0.1/dfm/integrations/repokg/provider.py +314 -0
  56. dfm_agent-0.0.1/dfm/integrations/repokg/structure.py +167 -0
  57. dfm_agent-0.0.1/dfm/lsp/__init__.py +5 -0
  58. dfm_agent-0.0.1/dfm/lsp/client.py +527 -0
  59. dfm_agent-0.0.1/dfm/models/__init__.py +33 -0
  60. dfm_agent-0.0.1/dfm/models/apple/__init__.py +5 -0
  61. dfm_agent-0.0.1/dfm/models/apple/fm.py +248 -0
  62. dfm_agent-0.0.1/dfm/models/base.py +127 -0
  63. dfm_agent-0.0.1/dfm/models/mlx/__init__.py +6 -0
  64. dfm_agent-0.0.1/dfm/models/mlx/discovery.py +225 -0
  65. dfm_agent-0.0.1/dfm/models/mlx/evaluate.py +125 -0
  66. dfm_agent-0.0.1/dfm/models/mlx/model.py +377 -0
  67. dfm_agent-0.0.1/dfm/models/mlx/text.py +210 -0
  68. dfm_agent-0.0.1/dfm/models/mlx/worker.py +519 -0
  69. dfm_agent-0.0.1/dfm/models/pool.py +170 -0
  70. dfm_agent-0.0.1/dfm/models/resources.py +238 -0
  71. dfm_agent-0.0.1/dfm/models/schema.py +78 -0
  72. dfm_agent-0.0.1/dfm/models/structured.py +113 -0
  73. dfm_agent-0.0.1/dfm/models/tasks.py +65 -0
  74. dfm_agent-0.0.1/dfm/models/thermal.py +58 -0
  75. dfm_agent-0.0.1/dfm/observability/__init__.py +6 -0
  76. dfm_agent-0.0.1/dfm/observability/logs.py +55 -0
  77. dfm_agent-0.0.1/dfm/observability/metrics.py +160 -0
  78. dfm_agent-0.0.1/dfm/orchestration/__init__.py +1 -0
  79. dfm_agent-0.0.1/dfm/orchestration/agent.py +887 -0
  80. dfm_agent-0.0.1/dfm/orchestration/ask.py +96 -0
  81. dfm_agent-0.0.1/dfm/orchestration/ci.py +183 -0
  82. dfm_agent-0.0.1/dfm/orchestration/github.py +340 -0
  83. dfm_agent-0.0.1/dfm/orchestration/implement.py +117 -0
  84. dfm_agent-0.0.1/dfm/orchestration/plan.py +243 -0
  85. dfm_agent-0.0.1/dfm/orchestration/resume.py +150 -0
  86. dfm_agent-0.0.1/dfm/orchestration/review.py +541 -0
  87. dfm_agent-0.0.1/dfm/orchestration/runtime.py +246 -0
  88. dfm_agent-0.0.1/dfm/orchestration/security_review.py +422 -0
  89. dfm_agent-0.0.1/dfm/orchestration/setup.py +214 -0
  90. dfm_agent-0.0.1/dfm/policy/__init__.py +35 -0
  91. dfm_agent-0.0.1/dfm/policy/engine.py +273 -0
  92. dfm_agent-0.0.1/dfm/policy/network.py +211 -0
  93. dfm_agent-0.0.1/dfm/policy/types.py +104 -0
  94. dfm_agent-0.0.1/dfm/processes/__init__.py +35 -0
  95. dfm_agent-0.0.1/dfm/processes/manager.py +613 -0
  96. dfm_agent-0.0.1/dfm/provenance/__init__.py +5 -0
  97. dfm_agent-0.0.1/dfm/provenance/item.py +140 -0
  98. dfm_agent-0.0.1/dfm/py.typed +0 -0
  99. dfm_agent-0.0.1/dfm/recovery/__init__.py +5 -0
  100. dfm_agent-0.0.1/dfm/recovery/checkpoint.py +198 -0
  101. dfm_agent-0.0.1/dfm/recovery/reconcile.py +97 -0
  102. dfm_agent-0.0.1/dfm/repository/__init__.py +1 -0
  103. dfm_agent-0.0.1/dfm/repository/freshness.py +220 -0
  104. dfm_agent-0.0.1/dfm/repository/intelligence.py +123 -0
  105. dfm_agent-0.0.1/dfm/routing/__init__.py +23 -0
  106. dfm_agent-0.0.1/dfm/routing/evidence.py +111 -0
  107. dfm_agent-0.0.1/dfm/routing/router.py +288 -0
  108. dfm_agent-0.0.1/dfm/routing/routes.py +13 -0
  109. dfm_agent-0.0.1/dfm/secrets/__init__.py +29 -0
  110. dfm_agent-0.0.1/dfm/secrets/redact.py +422 -0
  111. dfm_agent-0.0.1/dfm/security/__init__.py +1 -0
  112. dfm_agent-0.0.1/dfm/security/checklists/cairo.toml +17 -0
  113. dfm_agent-0.0.1/dfm/security/checklists/ci.toml +41 -0
  114. dfm_agent-0.0.1/dfm/security/checklists/generic.toml +43 -0
  115. dfm_agent-0.0.1/dfm/security/checklists/go.toml +41 -0
  116. dfm_agent-0.0.1/dfm/security/checklists/infra.toml +49 -0
  117. dfm_agent-0.0.1/dfm/security/checklists/javascript.toml +82 -0
  118. dfm_agent-0.0.1/dfm/security/checklists/python.toml +82 -0
  119. dfm_agent-0.0.1/dfm/security/checklists/rust.toml +26 -0
  120. dfm_agent-0.0.1/dfm/security/checklists/solidity.toml +49 -0
  121. dfm_agent-0.0.1/dfm/security/injection.py +34 -0
  122. dfm_agent-0.0.1/dfm/security/sandbox.py +169 -0
  123. dfm_agent-0.0.1/dfm/services/__init__.py +14 -0
  124. dfm_agent-0.0.1/dfm/services/catalog.py +174 -0
  125. dfm_agent-0.0.1/dfm/services/manager.py +361 -0
  126. dfm_agent-0.0.1/dfm/sessions/__init__.py +29 -0
  127. dfm_agent-0.0.1/dfm/sessions/protocol.py +183 -0
  128. dfm_agent-0.0.1/dfm/sessions/store.py +309 -0
  129. dfm_agent-0.0.1/dfm/tools/__init__.py +1 -0
  130. dfm_agent-0.0.1/dfm/tools/blockchain/__init__.py +19 -0
  131. dfm_agent-0.0.1/dfm/tools/blockchain/chains.py +188 -0
  132. dfm_agent-0.0.1/dfm/tools/docker/__init__.py +5 -0
  133. dfm_agent-0.0.1/dfm/tools/docker/engine.py +158 -0
  134. dfm_agent-0.0.1/dfm/tools/errors.py +5 -0
  135. dfm_agent-0.0.1/dfm/tools/filesystem/__init__.py +35 -0
  136. dfm_agent-0.0.1/dfm/tools/filesystem/kinds.py +209 -0
  137. dfm_agent-0.0.1/dfm/tools/filesystem/patching.py +261 -0
  138. dfm_agent-0.0.1/dfm/tools/filesystem/tools.py +448 -0
  139. dfm_agent-0.0.1/dfm/tools/generated.py +231 -0
  140. dfm_agent-0.0.1/dfm/tools/git/__init__.py +28 -0
  141. dfm_agent-0.0.1/dfm/tools/git/guard.py +212 -0
  142. dfm_agent-0.0.1/dfm/tools/git/hardening.py +30 -0
  143. dfm_agent-0.0.1/dfm/tools/git/state.py +83 -0
  144. dfm_agent-0.0.1/dfm/tools/git/tools.py +277 -0
  145. dfm_agent-0.0.1/dfm/tools/git/worktree.py +120 -0
  146. dfm_agent-0.0.1/dfm/tools/github/__init__.py +1 -0
  147. dfm_agent-0.0.1/dfm/tools/kubernetes/__init__.py +5 -0
  148. dfm_agent-0.0.1/dfm/tools/kubernetes/context.py +72 -0
  149. dfm_agent-0.0.1/dfm/tools/languages/__init__.py +53 -0
  150. dfm_agent-0.0.1/dfm/tools/languages/base.py +131 -0
  151. dfm_agent-0.0.1/dfm/tools/languages/cairo.py +146 -0
  152. dfm_agent-0.0.1/dfm/tools/languages/go.py +155 -0
  153. dfm_agent-0.0.1/dfm/tools/languages/python.py +237 -0
  154. dfm_agent-0.0.1/dfm/tools/languages/rust.py +157 -0
  155. dfm_agent-0.0.1/dfm/tools/languages/solidity.py +156 -0
  156. dfm_agent-0.0.1/dfm/tools/languages/swift.py +148 -0
  157. dfm_agent-0.0.1/dfm/tools/languages/typescript.py +275 -0
  158. dfm_agent-0.0.1/dfm/tools/logs.py +366 -0
  159. dfm_agent-0.0.1/dfm/tools/packages.py +360 -0
  160. dfm_agent-0.0.1/dfm/tools/results.py +945 -0
  161. dfm_agent-0.0.1/dfm/tools/shell/__init__.py +1 -0
  162. dfm_agent-0.0.1/dfm/tools/shell/classify.py +308 -0
  163. dfm_agent-0.0.1/dfm/tools/shell/rules.py +2518 -0
  164. dfm_agent-0.0.1/dfm/tools/shell/runner.py +170 -0
  165. dfm_agent-0.0.1/pyproject.toml +127 -0
@@ -0,0 +1,19 @@
1
+ .venv/
2
+ __pycache__/
3
+ *.pyc
4
+ .pytest_cache/
5
+ .ruff_cache/
6
+ .pyright/
7
+ dist/
8
+ build/
9
+ *.egg-info/
10
+ .dfm/
11
+ .DS_Store
12
+
13
+ # Local working files: the development log and agent working notes stay on this machine
14
+ BUILD_STATE.md
15
+ HANDOVER.md
16
+ MASTER_PROMPT.md
17
+ issues/
18
+ docs/upstream/
19
+ docs/milestones/
@@ -0,0 +1,56 @@
1
+ # Changelog
2
+
3
+ Format: [Keep a Changelog](https://keepachangelog.com/en/1.1.0/). Versioning:
4
+ [Semantic Versioning](https://semver.org/); before 1.0, any release may contain breaking changes.
5
+
6
+ ## [Unreleased]
7
+
8
+ ### Fixed
9
+
10
+ - On Python 3.12, a command that left a background process holding its output (for example a
11
+ test run that starts a daemon) blocked until its timeout. DFM now reads output pipes itself,
12
+ so it stops waiting when the command exits on every supported Python version.
13
+ - Type checking failed without the optional `mlx` extra.
14
+ - A versioned Xcode install (`/Applications/Xcode_16.4.app`, as on CI runners and machines
15
+ with several Xcodes) was treated as outside the repository boundary, so policy refused
16
+ `swift test` with the Swift Testing plugin path.
17
+ - Service and Docker availability checks looked up binaries on DFM's own `PATH` rather than
18
+ the one the command then runs with.
19
+ - The configuration reference split rows whose type contains `|` (such as `int | None`).
20
+ - A diagram in `ARCHITECTURE.md` did not render on GitHub.
21
+
22
+ ### Changed
23
+
24
+ - Live model tests are opt-in through `DFM_TEST_MODEL` and work with any local MLX model, not
25
+ only gpt-oss-20b. Model-logic tests no longer depend on whether `mlx` is installed.
26
+ - CI runs on Python 3.12 and 3.13, with actions pinned to commit SHAs.
27
+ - The package is distributed as `dfm-agent` (the command stays `dfm`); install with
28
+ `uv tool install "dfm-agent[mlx]"`. RepoCanon and RepoKG are released dependencies with
29
+ version bounds instead of pinned Git commits, the sdist contains only what the package ships,
30
+ and a tag push publishes to PyPI through trusted publishing (ADR 0014).
31
+
32
+ ## [0.0.1]
33
+
34
+ First public release.
35
+
36
+ ### Added
37
+
38
+ - Commands: `ask`, `plan`, `implement` (optionally in a worktree), `resume`, `review`,
39
+ `security-review`, `ci`, `fix-pr`, `review-pr`, `implement-issue`, `issue`, `pr`, `comments`,
40
+ `benchmark`, `doctor`, `setup`, `models`, `repo`, `diff`, `inspect-log`, `sessions`, `status`,
41
+ `profile`, `processes`, `services`, `memory`, `config`.
42
+ - On-device models: Apple FM through the `fm` CLI, and MLX models in a sandboxed worker process,
43
+ behind one interface with fallback and circuit breakers.
44
+ - Deterministic routing with an Apple FM tie-breaker and memory-aware model selection.
45
+ - Agent loop: one action per step, native tool calls, per-step reasoning effort, thinking and
46
+ task token budgets, history compaction, repair, and a verification ledger.
47
+ - Safeguards: command classifier, policy engine with typed confirmations, per-command macOS
48
+ sandbox, secret redaction, prompt-injection handling, Git guard and hardening, filesystem
49
+ boundary with checkpoints.
50
+ - Resource controls: memory admission, thermal pacing, loop cutoff, and a KV cache reused across
51
+ steps and sessions.
52
+ - Integrations: RepoCanon, RepoKG, Reflex, GitHub (`gh`), Docker and Compose, Kubernetes, LSP.
53
+ Language support: Python, TypeScript, Rust, Go, Swift, Solidity, Cairo.
54
+ - Versioned JSONL session traces, checkpoints and recovery, per-session metrics.
55
+ - Documentation: guide, architecture, command and configuration references, policy, threat
56
+ model, troubleshooting, ADRs 0001–0013.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Nihar Shah
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,112 @@
1
+ Metadata-Version: 2.5
2
+ Name: dfm-agent
3
+ Version: 0.0.1
4
+ Summary: Developer Foundation Model: a local, privacy-first engineering agent for Apple Silicon.
5
+ Project-URL: Homepage, https://github.com/NehharShah/dfm
6
+ Project-URL: Documentation, https://github.com/NehharShah/dfm/blob/main/docs/guide.md
7
+ Project-URL: Issues, https://github.com/NehharShah/dfm/issues
8
+ Project-URL: Changelog, https://github.com/NehharShah/dfm/blob/main/CHANGELOG.md
9
+ Author: Nihar Shah
10
+ License: MIT
11
+ License-File: LICENSE
12
+ Keywords: apple-silicon,coding-agent,developer-tools,local-llm,mlx,privacy
13
+ Classifier: Development Status :: 2 - Pre-Alpha
14
+ Classifier: Environment :: Console
15
+ Classifier: Intended Audience :: Developers
16
+ Classifier: License :: OSI Approved :: MIT License
17
+ Classifier: Operating System :: MacOS
18
+ Classifier: Programming Language :: Python :: 3
19
+ Classifier: Programming Language :: Python :: 3.12
20
+ Classifier: Programming Language :: Python :: 3.13
21
+ Classifier: Topic :: Software Development
22
+ Classifier: Topic :: Software Development :: Quality Assurance
23
+ Classifier: Typing :: Typed
24
+ Requires-Python: >=3.12
25
+ Requires-Dist: pydantic>=2.7
26
+ Requires-Dist: pyyaml>=6.0
27
+ Requires-Dist: repocanon<0.3,>=0.2.1
28
+ Requires-Dist: repokg<0.5,>=0.4.5
29
+ Requires-Dist: rich>=13.7.1
30
+ Requires-Dist: typer>=0.12.3
31
+ Provides-Extra: mlx
32
+ Requires-Dist: mlx-lm>=0.32.2; extra == 'mlx'
33
+ Description-Content-Type: text/markdown
34
+
35
+ # dfm — Developer Foundation Model
36
+
37
+ [![CI](https://github.com/NehharShah/dfm/actions/workflows/ci.yml/badge.svg)](https://github.com/NehharShah/dfm/actions/workflows/ci.yml)
38
+ [![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)
39
+ ![Platform: macOS on Apple Silicon](https://img.shields.io/badge/platform-macOS%20Apple%20Silicon-lightgrey)
40
+ ![Python 3.12+](https://img.shields.io/badge/python-3.12%2B-blue)
41
+
42
+ A coding agent that runs entirely on your Mac. DFM edits, builds, tests, repairs and verifies
43
+ code using on-device models: Apple FM for routing and short text, and a local MLX model for
44
+ code. Repository knowledge comes from [RepoCanon](https://github.com/NehharShah/repocanon),
45
+ [RepoKG](https://github.com/NehharShah/repokg) and, optionally,
46
+ [Reflex](https://github.com/sumervaid/reflex-tui).
47
+
48
+ DFM sends no code or prompts to hosted models. Other network access (GitHub, package registries)
49
+ is off or requires approval, per [policy](docs/policy.md).
50
+
51
+ **Status:** early (0.0.1). Commands and configuration may change.
52
+
53
+ ## Requirements
54
+
55
+ - macOS on Apple Silicon, Python 3.12+, [uv](https://docs.astral.sh/uv/), Git.
56
+ - Memory for the local model: the recommended 27B model (4-bit) needs about 18.5 GB at its
57
+ default context, so 32 GB or more is recommended. `dfm setup` picks a model that fits.
58
+ - Optional: Apple Intelligence, for Apple FM.
59
+
60
+ ## Quick start
61
+
62
+ Install `dfm` as a command (the package is `dfm-agent`; the command is `dfm`):
63
+
64
+ ```bash
65
+ uv tool install "dfm-agent[mlx]" # from PyPI, once released
66
+ uv tool install "git+https://github.com/NehharShah/dfm[mlx]" # or straight from GitHub
67
+ dfm doctor # check this machine
68
+ dfm setup # choose a local model
69
+ dfm implement "fix the failing test"
70
+ ```
71
+
72
+ Omit `[mlx]` to install without the local coder. Upgrade with `uv tool upgrade dfm-agent`.
73
+ To run from a checkout instead, see [CONTRIBUTING.md](CONTRIBUTING.md).
74
+
75
+ ## How it works
76
+
77
+ - The model proposes one action at a time (read, search, patch, run, test). DFM executes it,
78
+ reruns the tests after every edit, and reports only what a command verified.
79
+ - Every command is classified and checked against policy, then runs in a per-command macOS
80
+ sandbox. Destructive, production and mainnet actions require a typed confirmation. DFM does
81
+ not commit, push or rewrite history.
82
+ - Repository files, issues and CI logs reach the model as untrusted data, with secrets
83
+ redacted.
84
+ - Memory checks, thermal pacing, reasoning budgets and a persistent prompt cache keep the model
85
+ usable alongside other apps.
86
+
87
+ Modes: `ask`, `plan`, `implement`, `review`, `security-review`, `ci`, `fix-pr`,
88
+ `implement-issue`, `benchmark`. Full list: [command reference](docs/cli.md).
89
+
90
+ ## Documentation
91
+
92
+ [Guide](docs/guide.md) · [Architecture](ARCHITECTURE.md) · [Commands](docs/cli.md) ·
93
+ [Configuration](docs/config.md) · [Policy](docs/policy.md) · [Threat model](docs/threat-model.md) ·
94
+ [Troubleshooting](docs/troubleshooting.md) · [Design decisions](docs/decisions)
95
+
96
+ ## Contributing and security
97
+
98
+ See [CONTRIBUTING.md](CONTRIBUTING.md) and [AGENTS.md](AGENTS.md). Report vulnerabilities
99
+ privately as described in [SECURITY.md](SECURITY.md). Changes: [CHANGELOG.md](CHANGELOG.md).
100
+
101
+ ## License and notices
102
+
103
+ DFM is released under the [MIT License](LICENSE) and is provided "as is", without warranty of
104
+ any kind. DFM runs commands and changes files on your machine. Its safeguards reduce risk but do
105
+ not eliminate it. Review its changes before you commit them.
106
+
107
+ Models are third-party software under their own licenses, and you are responsible for complying
108
+ with the license of any model you download. RepoCanon, RepoKG and Reflex are separate projects
109
+ under their own licenses.
110
+
111
+ Apple, Apple Intelligence, Apple Silicon and macOS are trademarks of Apple Inc. DFM is an
112
+ independent project and is not affiliated with or endorsed by Apple.
@@ -0,0 +1,78 @@
1
+ # dfm — Developer Foundation Model
2
+
3
+ [![CI](https://github.com/NehharShah/dfm/actions/workflows/ci.yml/badge.svg)](https://github.com/NehharShah/dfm/actions/workflows/ci.yml)
4
+ [![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)
5
+ ![Platform: macOS on Apple Silicon](https://img.shields.io/badge/platform-macOS%20Apple%20Silicon-lightgrey)
6
+ ![Python 3.12+](https://img.shields.io/badge/python-3.12%2B-blue)
7
+
8
+ A coding agent that runs entirely on your Mac. DFM edits, builds, tests, repairs and verifies
9
+ code using on-device models: Apple FM for routing and short text, and a local MLX model for
10
+ code. Repository knowledge comes from [RepoCanon](https://github.com/NehharShah/repocanon),
11
+ [RepoKG](https://github.com/NehharShah/repokg) and, optionally,
12
+ [Reflex](https://github.com/sumervaid/reflex-tui).
13
+
14
+ DFM sends no code or prompts to hosted models. Other network access (GitHub, package registries)
15
+ is off or requires approval, per [policy](docs/policy.md).
16
+
17
+ **Status:** early (0.0.1). Commands and configuration may change.
18
+
19
+ ## Requirements
20
+
21
+ - macOS on Apple Silicon, Python 3.12+, [uv](https://docs.astral.sh/uv/), Git.
22
+ - Memory for the local model: the recommended 27B model (4-bit) needs about 18.5 GB at its
23
+ default context, so 32 GB or more is recommended. `dfm setup` picks a model that fits.
24
+ - Optional: Apple Intelligence, for Apple FM.
25
+
26
+ ## Quick start
27
+
28
+ Install `dfm` as a command (the package is `dfm-agent`; the command is `dfm`):
29
+
30
+ ```bash
31
+ uv tool install "dfm-agent[mlx]" # from PyPI, once released
32
+ uv tool install "git+https://github.com/NehharShah/dfm[mlx]" # or straight from GitHub
33
+ dfm doctor # check this machine
34
+ dfm setup # choose a local model
35
+ dfm implement "fix the failing test"
36
+ ```
37
+
38
+ Omit `[mlx]` to install without the local coder. Upgrade with `uv tool upgrade dfm-agent`.
39
+ To run from a checkout instead, see [CONTRIBUTING.md](CONTRIBUTING.md).
40
+
41
+ ## How it works
42
+
43
+ - The model proposes one action at a time (read, search, patch, run, test). DFM executes it,
44
+ reruns the tests after every edit, and reports only what a command verified.
45
+ - Every command is classified and checked against policy, then runs in a per-command macOS
46
+ sandbox. Destructive, production and mainnet actions require a typed confirmation. DFM does
47
+ not commit, push or rewrite history.
48
+ - Repository files, issues and CI logs reach the model as untrusted data, with secrets
49
+ redacted.
50
+ - Memory checks, thermal pacing, reasoning budgets and a persistent prompt cache keep the model
51
+ usable alongside other apps.
52
+
53
+ Modes: `ask`, `plan`, `implement`, `review`, `security-review`, `ci`, `fix-pr`,
54
+ `implement-issue`, `benchmark`. Full list: [command reference](docs/cli.md).
55
+
56
+ ## Documentation
57
+
58
+ [Guide](docs/guide.md) · [Architecture](ARCHITECTURE.md) · [Commands](docs/cli.md) ·
59
+ [Configuration](docs/config.md) · [Policy](docs/policy.md) · [Threat model](docs/threat-model.md) ·
60
+ [Troubleshooting](docs/troubleshooting.md) · [Design decisions](docs/decisions)
61
+
62
+ ## Contributing and security
63
+
64
+ See [CONTRIBUTING.md](CONTRIBUTING.md) and [AGENTS.md](AGENTS.md). Report vulnerabilities
65
+ privately as described in [SECURITY.md](SECURITY.md). Changes: [CHANGELOG.md](CHANGELOG.md).
66
+
67
+ ## License and notices
68
+
69
+ DFM is released under the [MIT License](LICENSE) and is provided "as is", without warranty of
70
+ any kind. DFM runs commands and changes files on your machine. Its safeguards reduce risk but do
71
+ not eliminate it. Review its changes before you commit them.
72
+
73
+ Models are third-party software under their own licenses, and you are responsible for complying
74
+ with the license of any model you download. RepoCanon, RepoKG and Reflex are separate projects
75
+ under their own licenses.
76
+
77
+ Apple, Apple Intelligence, Apple Silicon and macOS are trademarks of Apple Inc. DFM is an
78
+ independent project and is not affiliated with or endorsed by Apple.
@@ -0,0 +1,43 @@
1
+ # Security policy
2
+
3
+ DFM runs repository code and acts on proposals from a local model, which can be manipulated by
4
+ the content it reads. A way around its safeguards (policy, command classifier, sandbox, secret
5
+ redaction or Git guard) is a vulnerability. The threats DFM is designed against are listed in
6
+ [docs/threat-model.md](docs/threat-model.md).
7
+
8
+ ## Reporting
9
+
10
+ Report vulnerabilities privately through a
11
+ [GitHub security advisory](https://github.com/NehharShah/dfm/security/advisories/new). Do not open
12
+ a public issue.
13
+
14
+ Include:
15
+
16
+ - the command or a minimal repository that reproduces the issue;
17
+ - what DFM did and what you expected;
18
+ - `dfm --version`, the macOS version and the chip.
19
+
20
+ We aim to acknowledge reports within 7 days. Confirmed issues are fixed with a regression test
21
+ in the threat suite (`pytest -m threat`). With your consent, we credit you in the changelog.
22
+ Please allow a reasonable time for a fix before you disclose publicly.
23
+
24
+ ## In scope
25
+
26
+ - A command that runs without the approval its policy requires.
27
+ - Reading protected paths, writing outside allowed paths, or reaching the network from inside
28
+ the sandbox without approval.
29
+ - Secrets reaching model context, session traces, logs or approval prompts.
30
+ - Repository content, issues, CI logs or tool output changing DFM's policy or configuration.
31
+ - DFM overwriting uncommitted work, pushing, or rewriting history without being asked.
32
+ - Any request to a hosted model.
33
+
34
+ ## Out of scope
35
+
36
+ - Actions you approved, or allowed in your own configuration.
37
+ - The behaviour of code you asked DFM to run, within the sandbox's limits.
38
+ - Weaknesses in macOS or `sandbox-exec` itself, and running DFM without the sandbox.
39
+ - Vulnerabilities in RepoCanon, RepoKG or Reflex. Report those to their own projects.
40
+
41
+ ## Supported versions
42
+
43
+ Only the latest commit on `main` receives security fixes while DFM is at 0.x.
@@ -0,0 +1,10 @@
1
+ """DFM — Developer Foundation Model: a local, privacy-first engineering agent."""
2
+
3
+ from importlib.metadata import PackageNotFoundError, version
4
+
5
+ try:
6
+ __version__ = version("dfm-agent") # the distribution; the package and command are `dfm`
7
+ except PackageNotFoundError: # running from a source tree without an install
8
+ __version__ = "0.0.0+unknown"
9
+
10
+ __all__ = ["__version__"]
@@ -0,0 +1,25 @@
1
+ """`dfm benchmark`: ablation benchmarks over fixture tasks."""
2
+
3
+ from dfm.benchmark.runner import (
4
+ ABLATIONS,
5
+ ReferenceCoder,
6
+ RunResult,
7
+ run_suite,
8
+ run_task,
9
+ table,
10
+ write_results,
11
+ )
12
+ from dfm.benchmark.tasks import BY_ID, TASKS, BenchTask
13
+
14
+ __all__ = [
15
+ "ABLATIONS",
16
+ "BY_ID",
17
+ "TASKS",
18
+ "BenchTask",
19
+ "ReferenceCoder",
20
+ "RunResult",
21
+ "run_suite",
22
+ "run_task",
23
+ "table",
24
+ "write_results",
25
+ ]