Skip to content

[Feature][Mobile] Edit workspace Markdown files directly, including AGENTS.md #14438

Closed as not planned

Description

@camchis

Problem or use case

I want to make small edits to workspace Markdown files from the T3 Code mobile app without prompting an agent. The main use case is updating AGENTS.md: correcting an instruction, adding a project convention, or removing an outdated rule. The same flow should work for README files and other Markdown documents, then eventually all file formats should be supported.

Mobile currently lets me browse workspace files, view rendered Markdown or its source, and copy the contents, but it does not offer direct editing or saving back to the workspace. For a small text change, I have to ask an agent or use another client/editor.

Desktop and web already support direct source editing of workspace text files, with automatic saving. Mobile should offer a simple way to make the same kind of change.

Proposed behavior

  1. Open an existing Markdown file from the workspace Files browser or a workspace file link.
  2. Choose Edit to edit the raw Markdown in a native multiline text editor. Support selection, copy/paste, undo, and keyboard-aware scrolling; disable autocorrect and automatic capitalization that would alter Markdown or paths.
  3. Choose Save to write the contents to the connected environment's workspace, without starting an agent turn. Return to the file view with the saved contents visible.
  4. Choose Cancel to leave editing without writing changes. If there are unsaved changes, confirm before discarding them, including when navigating back or selecting another file.

Show the workspace-relative file path while editing so it is clear which file will change. Use the active environment and workspace/worktree, including remote connections; saving must not target a different checkout or create a copy on the phone.

If a save fails or the connection drops, keep the draft available and show an actionable error. Only report a successful save after the server confirms the write.

If an agent or another device changes the file after editing begins, do not silently overwrite it. Keep the draft and offer to reload the current file or explicitly overwrite it.

Smallest useful scope

  • Edit existing, fully loaded workspace Markdown files, including root and nested AGENTS.md files.
  • Support both iOS and Android through the existing React Native mobile client, including its phone and tablet file flows.
  • Keep the existing rendered preview and source viewer; add a plain source editor with explicit Save and Cancel.
  • Keep attachments, files outside the workspace, and truncated previews read-only.

A dedicated Open AGENTS.md shortcut and creation of a missing instructions file would be useful follow-ups. Longer term, mobile should support editing all workspace files, with Markdown as the first step. Rich-text editing, general code editing, Markdown formatting tools, and a full mobile IDE are outside the initial scope.

Editing AGENTS.md changes the file on disk. This feature should not promise that an already-running provider session immediately reloads its instructions.

Willingness to contribute

I’m happy to build this if maintainers are interested in the feature and agree on the scope. I’d start with the smallest useful version described above: editing existing workspace Markdown files on iOS and Android, with explicit Save and Cancel.

Implementation context

Source inspection of the current checkout shows that most of the file transport already exists:

  • apps/mobile/src/features/files/ThreadFilesRouteScreen.tsx handles workspace file loading, preview/source modes, and file actions.
  • apps/mobile/src/features/files/SourceFileSurface.tsx is a read-only source surface.
  • Mobile already exposes the shared projectEnvironment.writeFile command from packages/client-runtime/src/state/projectCommands.ts.
  • The server's WorkspaceFileSystem.writeFile writes workspace-relative files in the requested environment. No provider-specific adapter changes are needed to perform the edit.

The current write contract accepts a path and contents without an expected file revision/content check. Conflict detection would need a small contracts/server change rather than only a mobile UI change. Existing web/desktop callers should remain compatible.

Acceptance criteria

  • On iOS and Android, a user can open an existing workspace AGENTS.md, change its text, and save it without sending a prompt or starting an agent turn.
  • Other workspace Markdown files use the same editing flow, whether opened from Files or a workspace file link.
  • Saved contents are written to the selected environment and worktree, and appear in the file view after saving.
  • Cancel leaves the file unchanged; navigation cannot silently discard an unsaved draft.
  • A failed save or disconnected environment preserves the draft and allows retry.
  • Concurrent file changes are detected before overwriting; the user's draft remains available during conflict resolution.
  • Attachments, host files outside the workspace, and truncated previews cannot be edited through this flow.
  • Existing file browsing and preview behavior continues to work on phones and tablets, and existing web/desktop editing remains compatible.

Related work

  • PR #11637: in-place Lexical Markdown editor is an open draft for rich-text editing in the web/desktop file preview. It does not add editing to the React Native mobile app. This request is for a native plain-source editor on mobile.
  • No matching open mobile Markdown-editing PR or issue was found in the searches performed for this draft.

Activity

  1. juliusmarminge commented on Sep 30, 2026

    @juliusmarminge
    Member

    Triage

    Thanks for the detailed proposal. This is a feature request rather than a bug, and those usually live in Ideas, so it might get more visibility there.

    The gap is real, and it's not a duplicate. On mobile, ThreadFileScreen can show the preview or source, toggle word wrap, and copy the path or contents. SourceFileSurface is selectable highlighted text, not an editor, and there's no Edit or Save action anywhere. The phone file route and the tablet file pane both use that same screen. Host files opened from chat (absolute paths outside the workspace) and AttachmentFileScreen are read-only too.

    Web and desktop already edit workspace text in place. EditableFileSurface is contentEditable and writes through projects.writeFile after a 500 ms debounce. A truncated read (the first 1 MB) or a host file stays in the read-only source preview, and attachments never reach that editor.

    On mobile, projectEnvironment is built from the shared client atoms and already includes writeFile, but no mobile screen calls it. A few details matter for the scope you described:

    • ProjectWriteFileInput is only cwd, relativePath, and contents. WorkspaceFileSystem.writeFile resolves the path inside the requested environment's workspace, writes the string, and refreshes the file list. It doesn't compare against the version the client started from, so conflict detection would need a new optional field on that contract to keep existing web callers working.
    • The write creates missing parent directories and the file itself, so "existing files only" has to be enforced on the client.
    • Saving a truncated 1 MB preview would replace the rest of the file, so truncated previews need to stay read-only, as you proposed.
    • The write doesn't notify a running provider session, which matches your note that editing AGENTS.md shouldn't promise a live reload.

    Related but separate: Discussion #6916 (open, opening workspace links from mobile Markdown previews) and #11637 (open draft PR, a Lexical editor for the web file preview, not the React Native app).

  2. juliusmarminge commented on Sep 30, 2026

    @juliusmarminge
    Member

    Closing this issue as leftover hygiene — the proposal was moved to Ideas as #14444 per the triage note above. Please continue the conversation there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementRequested improvement or new capability.via-triageFiled through npx t3 triage

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions