McBasic™Get McBasic™ ↗
Build 881
Practical guide

Limit AI edits with Add to Chat

Distinguish source-sharing chips from permission to change a control, procedure or whole document.

Sharing and editing are different permissions#

Document chips select source to send. Add to Chat creates a target-marked scope chip defining what may change. With a nonempty scope, the toolchain checks Build, Fix, Apply selected and plan-stage proposals against it. More context does not silently widen that scope. An empty scope is not a read-only mode: choose Ask, Plan or Explain when no editing is intended.

Add the smallest useful target#

WhereCommandEditable target
A Designer control or selected controlsAdd to ChatSelected properties/layout and exclusively owned event handlers. Shared handlers remain read-only.
A control-array memberAdd Array to ChatAll current members and shared handlers; adding a new member still needs permission.
Empty Form canvasAdd Form to ChatThe whole Form’s code and layout.
Form/module/class/test in the Project treeAdd to ChatThe complete document.
A procedure in the editorAdd Procedure to ChatThat procedure’s signature and body.

Supporting declarations and called-procedure signatures can be read-only context. Nonvisual components have no canvas context menu; use the owning Form. A chat supports up to 32 scope items.

Treat a property accessor as its own item#

Property Get, Let and Set are separate scope items. The current change mechanism cannot replace a single property accessor in isolation: rewriting the containing document requires the corresponding permission card. Do not assume selecting Get automatically permits changing Let or a WithEvents subscriber.

Decide whether a proposal may cross the boundary#

ChoiceEffectImportant boundary
YesPermit the requested expansion for one CheckA repair after a failed Check asks again.
NoDo not apply the outside-scope change; ask for a solution within the boundaryA plan can pause as outside the scope when it cannot continue.
Yes, and add to scopePermit the change and retain eligible existing targets as scope chipsNew documents, new procedures, plugin references and migrations can only be allowed once.

A new control outside the selected controls, a second document or a new dependency needs a decision. Dependency approval and the apply policy remain separate gates. Sending another message while a permission card waits sets that proposal aside.

Keep the boundary current#

Control scope chips track object identity through renames. A control-array chip instead follows the array name: after renaming the array, add it again with Add Array to Chat. If an item is deleted, McBasic™ stops before the next send so you can review the removal. A plan can pause if its entire scope disappears. Removing a chip changes what later requests may modify, not changes already applied.

Scope and its permission decisions are stored locally with the chat. A conversation imported from another Mac does not import those grants, even when its questions and approved plan remain readable.

Test a narrow edit and its recovery#

Use the scoped greeting exercise for exact settings, prompts, complete expected handler code and a diff checklist. Reject unrelated edits, inspect the checked result, then Run the normal and empty-input cases.

Source baseline 20f4bfed6b · Build manifest
Sources & maintenance

Original web explanation, reviewed against these repository sources. API tables and example files follow the implementation.

  • docs/manual/16-working-with-the-ai-assistant.md
  • src/McBasic.Build/AiScope.cs
  • macos/McBasicIDE/Sources/AIScope.swift