Update subcontext feature to specify required vs conditional selection
>>> [!note] Migrated issue <!-- Drupal.org comment --> <!-- Migrated from issue #3571788. --> Reported by: [kristen pol](https://www.drupal.org/user/8389) Related to !64 >>> <p>[Tracker]<br> <strong>Update Summary: </strong>[One-line status update for stakeholders]<br> <strong>Check-in Date: </strong>MM/DD/YYYY<br> <strong>Blocked by: </strong>[#XXXXXX] (New issues on new lines)<br> <strong>Additional Collaborators: </strong> @username1, @username2<br> <em>Metadata is used by the <a href="https://www.drupalstarforge.ai/" title="AI Tracker">AI Tracker.</a> Docs and additional fields <a href="https://www.drupalstarforge.ai/ai-dashboard/docs" title="AI Issue Tracker Documentation">here</a>.</em><br> [/Tracker]</p> <h3 id="summary-problem-motivation">Problem/Motivation</h3> <p>Follow-up to:</p> <p><span class="drupalorg-gitlab-issue-link project-issue-status-info project-issue-status-7"><a href="https://www.drupal.org/project/ai_context/issues/3569312" title="Status: Closed (fixed)">#3569312: Add parent / child relationship for context</a></span><br> <span class="drupalorg-gitlab-issue-link project-issue-status-info project-issue-status-7"><a href="https://www.drupal.org/project/ai_context/issues/3569313" title="Status: Closed (fixed)">#3569313: Create design for context list UI to include subcontext</a></span></p> <p>Subcontext has been introduced, but we need to take it a step further to make it useful.</p> <p>We need to let the user specify whether the subcontext is required by default or conditionally selected.</p> <h3 id="summary-proposed-resolution">Proposed resolution</h3> <p>Discuss UX and update the context add/edit form</p> <h3 id="summary-remaining-tasks">Target date or deadline</h3> <p>February 2026</p> <h3 id="summary-remaining-tasks">Remaining tasks</h3> <ul> <li>Discuss UX</li> <li>Mockup approach</li> <li>Implement</li> <li>Review and test</li> </ul> <h3 id="testing-notes">Testing notes</h3> <ol> <li>Install Drupal 11.3</li> <li>Install ai 1.3, ai_agents, ai_agents_debugger</li> <li>Install ai_context dev (and switch to this MR branch)</li> <li>Add context item (fill in fields and save): /admin/ai/context/items/add</li> <li>Note: you should not see the parent or subcontext type on the form</li> <li>Choose "Add subcontext" under operations for the new context item on /admin/ai/context/items</li> <li>Note: you should see the parent and subcontext type on the form</li> <li>Fill in the fields and save the subcontext</li> <li>The subcontext will be nested under the parent context on /admin/ai/context/items</li> <li>Go to agent settings for taxonomy agent: /admin/ai/context/settings/agents/taxonomy_agent_config/edit</li> <li>Choose "Always include" for parent item and leave subcontext to "Subcontext inclusion"</li> <li>Go to agent debugger: /admin/config/ai/agents/debug?agent_id=taxonomy_agent_config</li> <li>Prompt: "list vocabularies" and choose model and click "Run Agent"</li> <li>Look at <code>AI INPUT</code> on right</li> <li>You should see the subcontext added along with its parent</li> <li>Note: The rest of the selection logic (conditional vs required) will be done in a separate issue as the selection rules need to be reworked in general</li> </ol> <h3 id="summary-ai-usage">AI usage (if applicable)</h3> <p>[ ] AI Assisted Issue<br> This issue was generated with AI assistance, but was reviewed and refined by the creator.</p> <p>[ ] AI Assisted Code<br> This code was mainly generated by a human, with AI autocompleting or parts AI generated, but under full human supervision.</p> <p>[x] AI Generated Code<br> This code was mainly generated by an AI with human guidance, and reviewed, tested, and refined by a human.</p> <p>[ ] Vibe Coded<br> This code was generated by an AI and has only been functionally tested.</p> > Related issue: [Issue #3569311](https://www.drupal.org/node/3569311)
issue