| Dimension | Shared | Only in A | Only in B | Overlap |
|---|---|---|---|---|
| Sections | 0 | 5 | 5 | 0% |
| Commands | 1 | 0 | 2 | 33% |
| Section tags | 1 | 1 | 5 | 14% |
What each file covers
Sections
0 shared · 5 only in A · 5 only in B- − AGENTS.md (app subproject)
- − 1. Environment & Gradle Setup
- − 2. Architecture & Submodules
- − 3. Development Guidelines
- − 4. Workflows & Verification (from `app/`)
- + AGENTS.md
- + 1. Environment & Execution Setup
- + 2. Codebase Structure & Architecture
- + 3. Build & Verification Workflows
- + 4. Guidelines for AI Models
Commands
1 shared · 0 only in A · 2 only in B- + cargo
- + rustc
- ./gradlew
Section tags
1 shared · 1 only in A · 5 only in B- − code-style
- + build
- + lint-format
- + architecture
- + git-pr
- + do-not
- setup
Line diff
topjohnwu/Magisk · app/AGENTS.md
@@ −1 @@
1# AGENTS.md (app subproject)
2
3Guidelines for AI models operating inside the `app/` subproject.
4
5## 1. Environment & Gradle Setup
6
7- **Working Directory:** Set working directory to `app/` when working on app code.
8- **Environment Wrapper:** Standalone `./gradlew` commands MUST be prefixed with `../scripts/env.py` (e.g., `../scripts/env.py ./gradlew assembleDebug`), or run `./build.py app` from root.
9
10## 2. Architecture & Submodules
11
12Multi-module Gradle project structure:
13- **`:apk`** (`apk/`): Legacy app APK. **Maintenance mode:** No new features should be added here.
14- **`:apk-ng`** (`apk-ng/`): Next-gen app variant. Primary target for new UI/app features.
15- **`:core`** (`core/`): Core domain logic, resources, Room DB, services. Primary target for core feature development.
16- **`:shared`** (`shared/`): Shared utilities and common data structures.
17- **`:stub`** (`stub/`): Lightweight stub app loader for hidden installs.
18- **`:stub-res`** (`stub-res/`): Stub-specific Android resources.
19- **`:test`** (`test/`): Application testing target.
20- **`:build-logic`** (`build-logic/`): Custom Gradle plugins and build logic.
21
22## 3. Development Guidelines
23
24- **Feature Development:** `:apk` is in maintenance mode. All new development MUST occur in `:core` and `:apk-ng`.
25- **Language & UI:** Written in Kotlin/Java. **Prefer Kotlin for all new code.** Uses Jetpack Compose for UI (prefer over View XML).
26- **String Resources:** Default strings in `core/src/main/res/values/strings.xml` and `stub-res/src/main/res/values/strings.xml`. Translations go in `values-[lang]/strings.xml`.
27- **Data Stack:** Room, KSP, Wire (Protocol Buffers), Moshi.
28
29## 4. Workflows & Verification (from `app/`)
30
31Prefix commands with `../scripts/env.py`:
32- **Build Main APK (Debug):** `../scripts/env.py ./gradlew :apk:assembleDebug`
33- **Build All Variants:** `../scripts/env.py ./gradlew assembleDebug`
34- **Build Stub APK:** `../scripts/env.py ./gradlew :stub:assembleDebug`
35- **Run Lint:** `../scripts/env.py ./gradlew lint`
36- **Run Unit Tests:** `../scripts/env.py ./gradlew test`
37- **Clean Artifacts:** `../scripts/env.py ./gradlew clean`
38
topjohnwu/Magisk · AGENTS.md
@@ +1 @@
1# AGENTS.md
2
3Guidelines and instructions for AI models and automated agents operating in the Magisk repository.
4
5## 1. Environment & Execution Setup
6
7- **`build.py` Invocations:** `./build.py` imports `scripts/env.py` internally and configures the environment automatically. It does **not** need to be prefixed with `scripts/env.py` (e.g., `./build.py all` or `./build.py native`).
8- **Direct Tool Executions:** Standalone commands outside of `build.py` (such as `./gradlew`, `cargo`, `rustc`, `ndk-build`, etc.) **MUST** be prefixed with `scripts/env.py` (e.g., `scripts/env.py ./gradlew assembleDebug`).
9- **NDK Toolchain Setup:** If NDK toolchain dependencies are missing or outdated, run `./build.py ndk`.
10
11## 2. Codebase Structure & Architecture
12
13- **`app/` (Android Application):** Multi-module Gradle project for the Android app. Refer to [`app/AGENTS.md`](app/AGENTS.md) for app architecture, submodules, Kotlin conventions, and Gradle workflows.
14- **`native/` (Native Core Binaries):** C, C++, and Rust codebase for building native components (`magisk`, `magiskinit`, `magiskboot`, `magiskpolicy`, `resetprop`). Refer to [`native/AGENTS.md`](native/AGENTS.md) for native architecture, submodules, FFI compilation, and Rust conventions.
15- **`build.py` (Primary Build Orchestrator):** Python script managing native builds, app packaging, Clippy runs, Cargo invocations, and cleanup.
16- **`tools/` & `scripts/`:** Build scripts, helper utilities (e.g., `elf-cleaner`), and environment setup tools.
17
18## 3. Build & Verification Workflows
19
20- **Build Complete Project (APK + Native):** `./build.py all`
21- **Build Native Components:** `./build.py native [target...]`
22- **Build Application Targets:** `./build.py app`, `./build.py stub`, `./build.py test`
23- **Rust Verification & Linting:** `./build.py clippy`, `./build.py cargo <cargo-commands...>`
24- **Clean Build Artifacts:** `./build.py clean [native|cpp|rust|java|app]`
25
26## 4. Guidelines for AI Models
27
281. **Git / Commit Control:** NEVER commit changes or amend an existing git commit without the user's explicit request or approval. When explicitly requested to commit changes, follow the 50/72 rule for commit messages (subject line <= 50 characters, blank line before body, wrap body lines at 72 characters) and include an `Assisted-by: <ModelVersion>` trailer in the commit message body (using a pretty name, e.g., `Assisted-by: Gemini 3.6 Flash`).
292. **Build Invocation:** Execute `./build.py <command>` directly without `scripts/env.py`. Prefix standalone tool executions (like `./gradlew` or raw `cargo`) with `scripts/env.py`.
303. **Pre-build Native Code:** Before modifying code in `native/`, build native binaries at least once with `./build.py native` to generate required bindings and header files.
314. **App Subproject Context:** Refer to [`app/AGENTS.md`](app/AGENTS.md) when working inside the `app/` subproject.
325. **Verification Loop:** After making changes, verify compilation and run linting/clippy checks for affected modules before concluding tasks.
33
@@ −1 +1 @@
1−# AGENTS.md (app subproject)
1+# AGENTS.md
22
3−Guidelines for AI models operating inside the `app/` subproject.
3+Guidelines and instructions for AI models and automated agents operating in the Magisk repository.
44
5−## 1. Environment & Gradle Setup
5+## 1. Environment & Execution Setup
66
7−- **Working Directory:** Set working directory to `app/` when working on app code.
8−- **Environment Wrapper:** Standalone `./gradlew` commands MUST be prefixed with `../scripts/env.py` (e.g., `../scripts/env.py ./gradlew assembleDebug`), or run `./build.py app` from root.
7+- **`build.py` Invocations:** `./build.py` imports `scripts/env.py` internally and configures the environment automatically. It does **not** need to be prefixed with `scripts/env.py` (e.g., `./build.py all` or `./build.py native`).
8+- **Direct Tool Executions:** Standalone commands outside of `build.py` (such as `./gradlew`, `cargo`, `rustc`, `ndk-build`, etc.) **MUST** be prefixed with `scripts/env.py` (e.g., `scripts/env.py ./gradlew assembleDebug`).
9+- **NDK Toolchain Setup:** If NDK toolchain dependencies are missing or outdated, run `./build.py ndk`.
910
10−## 2. Architecture & Submodules
11+## 2. Codebase Structure & Architecture
1112
12−Multi-module Gradle project structure:
13−- **`:apk`** (`apk/`): Legacy app APK. **Maintenance mode:** No new features should be added here.
14−- **`:apk-ng`** (`apk-ng/`): Next-gen app variant. Primary target for new UI/app features.
15−- **`:core`** (`core/`): Core domain logic, resources, Room DB, services. Primary target for core feature development.
16−- **`:shared`** (`shared/`): Shared utilities and common data structures.
17−- **`:stub`** (`stub/`): Lightweight stub app loader for hidden installs.
18−- **`:stub-res`** (`stub-res/`): Stub-specific Android resources.
19−- **`:test`** (`test/`): Application testing target.
20−- **`:build-logic`** (`build-logic/`): Custom Gradle plugins and build logic.
13+- **`app/` (Android Application):** Multi-module Gradle project for the Android app. Refer to [`app/AGENTS.md`](app/AGENTS.md) for app architecture, submodules, Kotlin conventions, and Gradle workflows.
14+- **`native/` (Native Core Binaries):** C, C++, and Rust codebase for building native components (`magisk`, `magiskinit`, `magiskboot`, `magiskpolicy`, `resetprop`). Refer to [`native/AGENTS.md`](native/AGENTS.md) for native architecture, submodules, FFI compilation, and Rust conventions.
15+- **`build.py` (Primary Build Orchestrator):** Python script managing native builds, app packaging, Clippy runs, Cargo invocations, and cleanup.
16+- **`tools/` & `scripts/`:** Build scripts, helper utilities (e.g., `elf-cleaner`), and environment setup tools.
2117
22−## 3. Development Guidelines
18+## 3. Build & Verification Workflows
2319
24−- **Feature Development:** `:apk` is in maintenance mode. All new development MUST occur in `:core` and `:apk-ng`.
25−- **Language & UI:** Written in Kotlin/Java. **Prefer Kotlin for all new code.** Uses Jetpack Compose for UI (prefer over View XML).
26−- **String Resources:** Default strings in `core/src/main/res/values/strings.xml` and `stub-res/src/main/res/values/strings.xml`. Translations go in `values-[lang]/strings.xml`.
27−- **Data Stack:** Room, KSP, Wire (Protocol Buffers), Moshi.
20+- **Build Complete Project (APK + Native):** `./build.py all`
21+- **Build Native Components:** `./build.py native [target...]`
22+- **Build Application Targets:** `./build.py app`, `./build.py stub`, `./build.py test`
23+- **Rust Verification & Linting:** `./build.py clippy`, `./build.py cargo <cargo-commands...>`
24+- **Clean Build Artifacts:** `./build.py clean [native|cpp|rust|java|app]`
2825
29−## 4. Workflows & Verification (from `app/`)
26+## 4. Guidelines for AI Models
3027
31−Prefix commands with `../scripts/env.py`:
32−- **Build Main APK (Debug):** `../scripts/env.py ./gradlew :apk:assembleDebug`
33−- **Build All Variants:** `../scripts/env.py ./gradlew assembleDebug`
34−- **Build Stub APK:** `../scripts/env.py ./gradlew :stub:assembleDebug`
35−- **Run Lint:** `../scripts/env.py ./gradlew lint`
36−- **Run Unit Tests:** `../scripts/env.py ./gradlew test`
37−- **Clean Artifacts:** `../scripts/env.py ./gradlew clean`
28+1. **Git / Commit Control:** NEVER commit changes or amend an existing git commit without the user's explicit request or approval. When explicitly requested to commit changes, follow the 50/72 rule for commit messages (subject line <= 50 characters, blank line before body, wrap body lines at 72 characters) and include an `Assisted-by: <ModelVersion>` trailer in the commit message body (using a pretty name, e.g., `Assisted-by: Gemini 3.6 Flash`).
29+2. **Build Invocation:** Execute `./build.py <command>` directly without `scripts/env.py`. Prefix standalone tool executions (like `./gradlew` or raw `cargo`) with `scripts/env.py`.
30+3. **Pre-build Native Code:** Before modifying code in `native/`, build native binaries at least once with `./build.py native` to generate required bindings and header files.
31+4. **App Subproject Context:** Refer to [`app/AGENTS.md`](app/AGENTS.md) when working inside the `app/` subproject.
32+5. **Verification Loop:** After making changes, verify compilation and run linting/clippy checks for affected modules before concluding tasks.
3833
