Skip to content

docs(360): project-oriented editing and extensions feasibility study - #396

Merged
karaaslanz merged 3 commits into
petertzy:mainfrom
Eswar0108:docs/360-extensions-study
Oct 15, 2026
Merged

karaaslanz merged 3 commits into
petertzy:mainfrom
Eswar0108:docs/360-extensions-study

Conversation

@Eswar0108

Copy link
Copy Markdown
Collaborator

Fixes nothing code-wise; contributes to #360 (exploration deliverable).

What

Adds docs/ProjectExtensionsFeasibilityStudy.md — the exploration/architecture study requested by #360, in the same style as the existing docs/AIWorkPanelFeasibilityStudy.md. Docs-only, zero code/config/dependency changes.

Coverage — all seven suggested acceptance outputs

#360 acceptance output Section
Which project-oriented features belong in core §4.1 (built-in list + decision rule)
Proposed architecture for integrations/extensions §5.1 (layered diagram)
How extensions expose capabilities to the Work panel §5.2–§5.3 (manifest → registry → proposal contract)
Permissions/security model for tools that read/modify project content §6 (capability grants, threat model, deny-by-default)
Discover / install / enable / disable / configure lifecycle §7 (v1 deliberately minimal: folder-drop, no marketplace)
Which features stay built-in rather than extensions §4.1 + §4.3 (explicit out-of-scope)
One small proof-of-concept if practical §8 (Local Model Bridge sketch + exit criteria)

Grounded in the actual codebase

Every factual claim was verified against current sources before writing:

  • POST /api/ai/work single-document contract + stale-result guard + undoable apply (backend/routers/ai.py, frontend/src/hooks/useAIActions.ts)
  • The project-level primitives already exist: find_note_files() + SQLite FTS5 indexing in backend/knowledge_logic.py
  • Key security finding: backend/routers/files.py serves absolute-path read/write with no sandbox — acceptable for user-initiated calls today, but must gain project clamping + review mediation the moment a model or extension can drive it (§6.3)
  • Provider stack, secure key storage, and settings persistence as the reuse surface (§5–§7)
  • AIPanel tab shell (chat / work / translate / settings) as the capability renderer

Sequencing (per the issue's Important Considerations)

The study is explicitly gated behind #357 (project-wide AI workflows, currently assigned to @petertzy): §10 recommends no extension code be merged until #357 ships, a project-root concept exists, and one concrete third-party need is identified. Until then this document is the deliverable.

Verification

  • All 7 referenced files and 10 referenced symbols/endpoints grepped against the repo before submission
  • Structure mirrors the accepted AIWorkPanelFeasibilityStudy.md precedent (header block, numbered sections, tables, verdict)
  • Docs-only → no CI risk; Frontend/Backend checks untouched

Exploration deliverable for petertzy#360, in the style of the existing
AIWorkPanelFeasibilityStudy.md. Zero code/config/dependency changes.

Covers all seven suggested acceptance outputs: core-vs-extension
boundary with decision rule, layered capability architecture plus the
Work-panel capability model and invocation contract, deny-by-default
permissions/security model, enablement lifecycle (folder-drop only,
no marketplace), explicit built-in/out-of-scope lists, a Local Model
Bridge PoC sketch gated on petertzy#357, and a feasibility verdict of
"technically feasible, organizationally gated".

Every factual claim was verified against current sources before
writing: the /api/ai/work contract and stale-result guard, the
pre-existing project primitives (find_note_files, SQLite FTS5
indexing), the unsandboxed files-router surface, provider/key-storage
infrastructure, and the AIPanel tab shell.
@petertzy
petertzy requested review from karaaslanz and lwu1822 October 9, 2026 12:20

@lwu1822 lwu1822 left a comment •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, this is excellent grounding! Requesting changes for one small fix, the last paragraph in this doc belongs under section 4.3. Otherwise, everything else looks good to me!


Until step 3 is triggered, **no extension code should be merged**, keeping the core small and the default experience untouched, per the issue's own guidance.

Arbitrary code execution, shell access, UI plugins that inject into the editor DOM, and anything that bypasses the review pipeline. The issue's design principle — *"minimal impact on users who do not need extensions"* — implies the default install carries **zero** of §4.2.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's move this paragraph under line 79, "### 4.3 Explicitly out of scope"!

Address review feedback on petertzy#396: the closing paragraph listing
what extensions must never do (arbitrary code execution, shell
access, DOM-injecting UI plugins) was left at the end of the
document instead of under "4.3 Explicitly out of scope", where
it belongs.

@karaaslanz karaaslanz left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the thorough, intentionally docs-only exploration. I reviewed the exact updated head c63d084 and #360's explicit "security and isolation" acceptance principle, including the existing backend/main.py and backend/routers/files.py trust boundary. The prior reviewer's section-4.3 placement request appears addressed in this updated head.

One important architecture-contract inconsistency remains before this study should be accepted as guidance:

  • Section 5.1 proposes a future extension host using "subprocess/HTTP tools"; Section 7 installs extension folders; Sections 6.1-6.2 promise that even a malicious extension cannot read beyond the project, exfiltrate API keys, or reach arbitrary network destinations, with "no ambient authority".
  • But Section 6.3 defers subprocess sandboxing to Phase 2. If a third-party extension can execute its own process/code with the application's user privileges, backend-only project path clamping, JSON manifests, and an HTTP egress proxy do NOT constrain that process's direct OS filesystem or socket access. The existing /api/files/read and /api/files/write also accept absolute paths, and the shared X-Markdown-Reader-Token is only a local API boundary, not a sandbox for executable extensions. This discrepancy would be critical precisely when real third-party code is first enabled.

Suggested small documentation-only fix (no feature implementation required): explicitly choose one enforceable Phase-1 trust/execution model:
(a) first phase allows only declarative manifests / backend-owned, audited adapters with NO arbitrary third-party executable code, keeping the subprocess host out of scope until OS-level isolation; or
(b) running untrusted extension processes is conditional on a real OS-level filesystem/network/secret isolation boundary being implemented and tested before first enable.
Then qualify "cannot read/exfiltrate" guarantees and net:allowlist/project:read permission semantics against that chosen execution model. No need to design the sandbox in this exploratory PR, only avoid promising a security property the proposed v1 cannot enforce.

Everything else is useful as a feasibility study; I am not asking for extension code or a marketplace. The current exact-head CI reports SUCCESS. This review is source/design-level only; no full app test or extension runtime was executed. No push or merge on my side.

@Eswar0108

Copy link
Copy Markdown
Collaborator Author

Done in c63d084 — moved the out-of-scope paragraph (arbitrary code execution, shell access, DOM-injecting UI plugins) into §4.3, where it now fills the previously empty heading, and trimmed the stray tail from after §10. Thanks for the review!

@Eswar0108
Eswar0108 requested a review from lwu1822 October 11, 2026 12:58
@petertzy

petertzy commented Oct 13, 2026 •

Copy link
Copy Markdown
Owner

Designing an entirely new way of interacting with projects from scratch, while also ensuring that it is welcomed and accepted by users, involves significant risks and challenges. To make the plan more practical and achievable in its initial stage, I would prefer to first implement a project interaction version similar to that of Visual Studio Code (VS Code). In the future, we can build upon this foundation and gradually develop our own unique approach to project interaction.

Regarding the plugin system, my original idea was to have the core application invoke these external plugins while strictly preventing them from accessing any part of the main project. The goal is to achieve the highest possible level of security.

However, whether it is technically feasible to completely prevent plugins from making reverse calls or otherwise accessing the main application is an important question that this document should investigate and attempt to answer.

If the research ultimately concludes that no sufficiently secure solution exists, then abandoning the plugin system would be the necessary choice.

@karaaslanz

Copy link
Copy Markdown
Collaborator

Thanks for clarifying the direction. A VS Code-like project interaction layer first, with plugins conditional on a demonstrable isolation boundary, seems like the safer order.

On the specific feasibility question: the core process cannot reliably prevent arbitrary filesystem access, local API calls, or outbound connections by an untrusted plugin that executes as a normal subprocess under the same OS user. Project-root checks, a manifest, a backend egress proxy and hiding the app's HTTP token only constrain brokered requests; such a subprocess can bypass them through its own filesystem/socket APIs. Blocking "reverse calls" alone therefore does not meet ?6.1's security goal.

There are two technically distinct options:

  1. Safe initial scope without an OS sandbox: declarative manifests and backend-owned, audited capability adapters only. No arbitrary third-party scripts, subprocesses, native modules, dynamic imports or plugin UI execution. Keep project interaction and explicit human-reviewed proposals in core.
  2. Executable third-party plugins later: require enforceable OS-level isolation before the first plugin is enabled, with a minimal broker for permitted reads/proposals, no ambient host filesystem/secrets/network/IPC access, and tested per-platform boundaries. Windows, macOS and Linux differ; a backend-only permission layer is not a substitute.

A concrete acceptance test would run a deliberately hostile sample plugin and verify it cannot read an unrelated project or the app's key storage, reach the local backend directly, open an unapproved network destination, escape via symlinks, or spawn an unsandboxed child. Test both denial and a legitimately brokered project:read operation.

For this docs-only PR, I'd suggest changing ?5.1/?6.3/?10 to make option 1 the only feasible Phase 1, and the subprocess host conditional, not a Phase 2 hardening detail. That answers the feasibility question without adding plugin code or prematurely promising absolute isolation.

@petertzy

Copy link
Copy Markdown
Owner

@karaaslanz, I'd like to add one more point: if we're going to introduce this plugin mechanism, I think the safest approach would be to initially limit the number of plugins to no more than three, and ensure that all of them are developed and maintained by us.
These plugins should be disabled by default. Users should be able to load or unload them as needed through a "Plugins" option on the right side of the menu.
I'd also appreciate it if you could make some minor adjustments to the documentation. It doesn't need to be comprehensive or perfect at this stage, as we can always refine and improve it later.
With these changes, I think we can move forward and get this PR merged. Please take care of the remaining finishing touches. No further review is necessary, and you can merge the PR yourself once everything is ready.
Otherwise, I'm concerned that this PR might remain open indefinitely without ever getting merged.
Thanks for your help!

@karaaslanz

Copy link
Copy Markdown
Collaborator

Thanks for clarifying the direction and authorizing a merge after the final documentation touches. I agree that the VS Code-like project workflow should come before any plugin execution.

I checked PR head c63d084. I attempted the docs-only update, but GitHub did not permit writing to the contributor's fork branch (404). No branch files were changed or merged.

@Eswar0108, could you please apply these bounded edits to docs/ProjectExtensionsFeasibilityStudy.md on this existing PR branch?

  1. Rollout: at most three project-developed and project-maintained plugins, all disabled by default. Users opt in via a Plugins option on the right side of the app menu to load/unload or enable/disable each plugin. No third-party executable downloads or folder-drop install in this first iteration.
  2. Isolation: clearly distinguish brokered permissions/path-clamping/egress restrictions from OS-level sandboxing. A plugin running as a normal subprocess under the same OS user can independently access files, local APIs or the network. Please adjust the diagram, threat-model claims and the statement that sandboxing can wait until Phase 2. If strict isolation is required but cannot be demonstrated, do not run untrusted plugins.
  3. Conclusion: keep Extend AI Workflows from the Active Document to the Entire Project #357 and project-root safeguards first. Describe the Local Model Bridge as a trusted, mediated proof of workflow integration, not proof of plugin isolation.

No new architecture or PR is necessary. Once the existing branch is updated, I can verify the exact changed head and checks, and follow the maintainer's merge direction if permissions allow.

Address review feedback from karaaslanz on petertzy#396:

1. Rollout: at most three project-developed/maintained plugins,
   all disabled by default, toggled via a Plugins option on the
   right side of the app menu; no third-party executable downloads
   or folder-drop install in this iteration.
2. Isolation: distinguish brokered permissions/path-clamping/egress
   from OS-level sandboxing. Annotate the 5.1 diagram, add a
   "Mediation != sandbox" note and the chosen Phase-1 execution
   model (a) (no arbitrary third-party executable code) to 6.1,
   qualify 6.2 permission semantics, and replace the "sandbox can
   wait until Phase 2" claim in 6.3.
3. Conclusion: keep petertzy#357 and project-root safeguards first; frame
   the Local Model Bridge as a trusted, mediated proof of workflow
   integration, not proof of plugin isolation.

@karaaslanz karaaslanz left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Follow-up on my earlier CHANGES_REQUESTED review. I checked docs-only head 47e26c7 and the green Backend/Frontend CI. The study now limits initial plugins to at most three first-party, project-maintained modules, disabled by default, with explicit per-plugin toggles under Plugins. It distinguishes brokered permission checks from OS-level process isolation and excludes arbitrary third-party executables without enforceable sandboxing. The Local Model Bridge is accurately scoped as trusted workflow integration, not sandbox proof. My earlier security/design concerns are addressed. Documentation-level approval only; no runtime plugin implementation was tested.

@karaaslanz
karaaslanz merged commit 0bc56d0 into petertzy:main Oct 15, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants