Manage AI instructions with Port
Send this guide to your coding agent.
Prerequisite: Install Port MCP
Open plan mode. Implement this Port guide in my org via MCP: https://docs.port.io/guides/all/manage-ai-instructions Goal: get the guide's core flow working end-to-end in my org; adapting it to fit my existing setup takes priority over matching the guide 1:1. Plan: 1. Confirm MCP is connected, in the right org, with sufficient permissions. 2. Diff the guide's data model (blueprints, properties, relations, actions, agents, automations, integrations, secrets) against mine. 3. Propose adaptations for gaps, reusing existing blueprints/relations over guide-named duplicates. 4. Flag what needs a UI click, credential, or secret from me, testing MCP capability empirically before ruling anything out. 5. Stop on any blocker and give me options. Approving this plan authorizes the writes it lists; pause only for writes beyond what's listed. Build: - Extend blueprint schema additively when upserting; don't remove or overwrite existing properties, and treat type conflicts as a blocker, not an auto-fix. - List any mock data in the plan, minimal and labeled mock; once approved, seed it without re-asking, and tell me what you seeded. - For anything the guide writes downstream (e.g. a webhook target), use a real entity, not a mock. - For pages/widgets, use the real page identifier from the app URL, not a guessed slug. - When you hit a UI step confirmed (not assumed) unsupported via MCP, pause, give exact clicks, then resume via MCP. - Validate and give links after each meaningful step (only a tool-returned URL, no guessed paths); don't proceed if the last run wasn't a success. Done: - Confirm the guide's expected output exists and runs in Port. - Summarize adaptations, seeded data, what was mocked or skipped, remaining UI steps, and how to verify.
In the age of AI coding agents (Claude, Copilot, Gemini, Cursor), teams need a single source of truth for how autonomous agents should contribute to repositories. Traditionally, these rules are stored manually in different locations based on the coding agent's specification such as .cursor/rules, .github/copilot-instructions, or other agent-specific folders. However, managing these scattered files at scale is cumbersome and leads to inconsistency.
To deal with this challenge, you can adopt the AGENTS.md structure as a unified standard for all AI coding instructions, regardless of the specific agent being used, and automate it with a Port workflow.
This guide demonstrates how to centralize AI instructions in Port and automatically sync them back into GitHub repositories whenever the ai_instructions property changes. When an update is detected, the workflow dispatches your chosen coding agent backend to open a pull request that updates AGENTS.md.
Common use cases
- Centralize AI guidelines by managing all AI agent instructions from a single location in Port.
- Ensure consistency across repositories by automatically syncing updated instructions via pull requests.
- Reduce manual overhead by eliminating the need for developers to manually update
AGENTS.mdfiles.
Prerequisites
This guide assumes the following:
- You have a Port account and have completed the onboarding process.
- The GitHub Ocean integration is installed in your account.
- You completed the GitHub backend setup for your preferred coding agent from the Trigger AI coding assistants from Port guide. You only need the backend workflow and secrets from that guide, not the self-service actions:
- Claude Code - deploy
claude-backend.yamlin your dedicated workflows repository. - GitHub Copilot - store
GITHUB_TOKENas a Port secret. - Google Gemini - deploy
gemini-backend.yamlin your dedicated workflows repository.
- Claude Code - deploy
Set up data model
We will enhance the GitHub repository blueprint to include AI instructions and configure the GitHub integration to sync these instructions automatically.
Update the repository blueprint
To track AI instructions, we need to add a property for managing AI agent contribution guidelines.
-
Go to the builder page in Port.
-
Find and select your existing repository blueprint (e.g.,
githubRepositoryorservice). -
Click on
{...} Edit JSON. -
Add the following property to the
propertiessection:AI instructions property (click to expand)
"ai_instructions": {"title": "AI Instructions","description": "Rules and contribution guidelines for AI coding agents","type": "string","format": "markdown"} -
Click
Saveto update the blueprint.
Update GitHub integration mapping
Now we need to configure the GitHub integration to automatically sync the AI instructions between Port and GitHub repositories.
-
Go to the data sources page in Port.
-
Find your GitHub integration and click on it.
-
Go to the
Mappingtab. -
Update the mapping configuration to include the AI instructions property:
GitHub Ocean integration mapping configuration (click to expand)
deleteDependentEntities: falsecreateMissingRelatedEntities: trueenableMergeEntity: trueresources:- kind: repositoryselector:query: trueincludedFiles:- README.md- AGENTS.mdport:entity:mappings:identifier: .full_nametitle: .nameblueprint: '"githubRepository"'properties:readme: .__includedFiles["README.md"]ai_instructions: .__includedFiles["AGENTS.md"]url: .html_urldefaultBranch: .default_branch -
Click
Saveto update the integration configuration.
The integration will look for the AGENTS.md file at the root of each repository. Ensure your repositories follow this standardized file structure for consistent mapping across your organization.
Centralizing AI instructions
The AGENTS.md pattern involves creating a centralized AGENTS.md file at the root of your repository that serves as the single source of truth for all AI coding instructions. To make your AI coding agents reference this standardized file, you need to configure them to point to it:
- Cursor
- GitHub Copilot
- Claude Code
- Other AI Agents
Create a .cursor/rules file in your repository with the following configuration:
---
description: General Guidelines
globs:
alwaysApply: true
---
@AGENTS.md
This configuration tells Cursor to always apply the guidelines from the AGENTS.md file to all files in your repository.
In your repository settings or create a .github/copilot-instructions.md file with:
Reference the `AGENTS.md` file for all coding guidelines and instructions.
For Claude Code, you can reference the AGENTS.md file in your CLAUDE.md:
Please follow the coding guidelines and instructions specified in the `AGENTS.md` file at the root of this repository.
For other AI coding agents, configure them to reference the AGENTS.md file in their respective configuration files:
- Gemini CLI: Add reference in your
GEMINI.mdcustom instructions file. - Port custom agents: Include instructions to read and follow the
AGENTS.mdfile.
The key is to ensure all agents point to the same centralized source of truth.
Build the workflow
When ai_instructions changes in Port, the workflow forwards the updated Markdown to your coding agent backend so it can update AGENTS.md in the target repository.
Choose the workflow JSON that matches your coding agent:
- Claude Code
- GitHub Copilot
- Google Gemini
This workflow dispatches claude-backend.yaml using a GitHub integration action. With GitHub Ocean, you do not need to add a GitHub token to Port secrets for the dispatch itself. The integration handles workflow dispatch authentication.
Build the workflow
-
Go to the Workflows page of your portal.
-
Click on the + Workflow button in the top-right corner.
-
In the Name field, enter
Sync AI instructions, then click Confirm. -
On the editor page, click the see workflow JSON button (the code icon) to open the JSON editor.
-
Copy and paste the workflow JSON below to replace the example workflow:
Sync AI instructions workflow JSON for Claude Code (click to expand)
{"identifier": "sync_ai_instructions","title": "Sync AI instructions","icon": "AI","description": "When AI instructions change on a service, dispatch Claude Code to update AGENTS.md","allowAnyoneToViewRuns": true,"nodes": [{"identifier": "trigger","title": "On AI instructions updated","icon": "DefaultProperty","description": "Trigger when the ai_instructions property changes on a service entity","config": {"type": "EVENT_TRIGGER","event": {"type": "ENTITY_UPDATED","blueprintIdentifier": "githubRepository"},"condition": {"type": "JQ","expressions": [".diff.before.properties.ai_instructions != .diff.after.properties.ai_instructions"],"combinator": "and"}},"variables": {}},{"identifier": "run_claude_code","title": "Update AGENTS.md with Claude Code","icon": "Code","description": "Dispatch the Claude Code backend workflow in the target repository","config": {"type": "INTEGRATION_ACTION","installationId": "<YOUR_GITHUB_OCEAN_INTEGRATION_ID>","integrationProvider": "github-ocean","integrationInvocationType": "dispatch_workflow","integrationActionExecutionProperties": {"org": "<YOUR_GITHUB_ORG>","repo": "<YOUR_WORKFLOW_REPO>","workflow": "claude-backend.yaml","workflowInputs": {"repo_name": "{{ .outputs.trigger.diff.after.relations.organization }}/{{ .outputs.trigger.diff.after.identifier }}","command": "Please update the repository by creating or replacing the AGENTS.md file at the root with the following content:\n\n```markdown\n{{ .outputs.trigger.diff.after.properties.ai_instructions }}\n```\n\nCommit this change on a new branch and open a pull request titled: 'chore: sync AGENTS.md from Port' with description: 'This PR updates AGENTS.md based on the latest instructions from Port.'"},"reportWorkflowStatus": true}},"variables": {}}],"connections": [{"sourceIdentifier": "trigger","targetIdentifier": "run_claude_code"}]} -
Click Save to save the workflow.
Replace YOUR_GITHUB_OCEAN_INTEGRATION_ID, YOUR_GITHUB_ORG, and YOUR_WORKFLOW_REPO with your GitHub Ocean integration ID, organization name, and the repository where claude-backend.yaml lives. You can find the integration ID on the Data sources page of your portal.
This workflow creates a GitHub issue on the target repository with the updated instructions and the auto_assign label so Copilot picks up the task. Store a GITHUB_TOKEN Port secret before publishing.
Build the workflow
-
Go to the Workflows page of your portal.
-
Click on the + Workflow button in the top-right corner.
-
In the Name field, enter
Sync AI instructions, then click Confirm. -
On the editor page, click the see workflow JSON button (the code icon) to open the JSON editor.
-
Copy and paste the workflow JSON below to replace the example workflow:
Sync AI instructions workflow JSON for GitHub Copilot (click to expand)
{"identifier": "sync_ai_instructions","title": "Sync AI instructions","icon": "AI","description": "When AI instructions change on a service, create a GitHub issue for Copilot to update AGENTS.md","allowAnyoneToViewRuns": true,"nodes": [{"identifier": "trigger","title": "On AI instructions updated","icon": "DefaultProperty","description": "Trigger when the ai_instructions property changes on a service entity","config": {"type": "EVENT_TRIGGER","event": {"type": "ENTITY_UPDATED","blueprintIdentifier": "githubRepository"},"condition": {"type": "JQ","expressions": [".diff.before.properties.ai_instructions != .diff.after.properties.ai_instructions"],"combinator": "and"}},"variables": {}},{"identifier": "create_copilot_issue","title": "Create Copilot issue","icon": "Github","description": "Create a GitHub issue with the updated AGENTS.md content and auto-assign to Copilot","config": {"type": "WEBHOOK","url": "https://api.github.com/repos/{{ .outputs.trigger.diff.after.relations.organization }}/{{ .outputs.trigger.diff.after.identifier }}/issues","agent": false,"synchronized": true,"method": "POST","headers": {"Accept": "application/vnd.github+json","Authorization": "Bearer {{ .secrets[\"GITHUB_TOKEN\"] }}","X-GitHub-Api-Version": "2026-03-10","Content-Type": "application/json"},"body": {"title": "Update AGENTS.md with latest AI instructions from Port","body": "## Task for Copilot\n\nUpdate the `AGENTS.md` file at the root of the repository. Replace its contents entirely with the Markdown provided below. Commit the change on a new branch and open a pull request with:\n\n- Title: 'chore: sync AGENTS.md from Port'\n- Description: 'This PR updates AGENTS.md based on the latest instructions from Port.'\n\n## New AGENTS.md Content\n\nMARKDOWN START\n\n{{ .outputs.trigger.diff.after.properties.ai_instructions }}\n\nMARKDOWN END","labels": ["ai-instructions", "auto_assign"]}},"variables": {}}],"connections": [{"sourceIdentifier": "trigger","targetIdentifier": "create_copilot_issue"}]} -
Click Save to save the workflow.
This workflow dispatches gemini-backend.yaml using a GitHub integration action. With GitHub Ocean, you do not need to add a GitHub token to Port secrets for the dispatch itself.
Build the workflow
-
Go to the Workflows page of your portal.
-
Click on the + Workflow button in the top-right corner.
-
In the Name field, enter
Sync AI instructions, then click Confirm. -
On the editor page, click the see workflow JSON button (the code icon) to open the JSON editor.
-
Copy and paste the workflow JSON below to replace the example workflow:
Sync AI instructions workflow JSON for Google Gemini (click to expand)
{"identifier": "sync_ai_instructions","title": "Sync AI instructions","icon": "AI","description": "When AI instructions change on a service, dispatch Gemini Assistant to update AGENTS.md","allowAnyoneToViewRuns": true,"nodes": [{"identifier": "trigger","title": "On AI instructions updated","icon": "DefaultProperty","description": "Trigger when the ai_instructions property changes on a service entity","config": {"type": "EVENT_TRIGGER","event": {"type": "ENTITY_UPDATED","blueprintIdentifier": "githubRepository"},"condition": {"type": "JQ","expressions": [".diff.before.properties.ai_instructions != .diff.after.properties.ai_instructions"],"combinator": "and"}},"variables": {}},{"identifier": "run_gemini_assistant","title": "Update AGENTS.md with Gemini","icon": "Code","description": "Dispatch the Gemini Assistant backend workflow in the target repository","config": {"type": "INTEGRATION_ACTION","installationId": "<YOUR_GITHUB_OCEAN_INTEGRATION_ID>","integrationProvider": "github-ocean","integrationInvocationType": "dispatch_workflow","integrationActionExecutionProperties": {"org": "<YOUR_GITHUB_ORG>","repo": "<YOUR_WORKFLOW_REPO>","workflow": "gemini-backend.yaml","workflowInputs": {"repo_name": "{{ .outputs.trigger.diff.after.relations.organization }}/{{ .outputs.trigger.diff.after.identifier }}","prompt": "Please update the repository by creating or replacing the AGENTS.md file at the root with the following content:\n\n```markdown\n{{ .outputs.trigger.diff.after.properties.ai_instructions }}\n```\n\nCommit this change on a new branch and open a pull request titled: 'chore: sync AGENTS.md from Port' with description: 'This PR updates AGENTS.md based on the latest instructions from Port.'"},"reportWorkflowStatus": true}},"variables": {}}],"connections": [{"sourceIdentifier": "trigger","targetIdentifier": "run_gemini_assistant"}]} -
Click Save to save the workflow.
Replace YOUR_GITHUB_OCEAN_INTEGRATION_ID, YOUR_GITHUB_ORG, and YOUR_WORKFLOW_REPO with your GitHub Ocean integration ID, organization name, and the repository where gemini-backend.yaml lives.
Test the workflow
Now let's test the complete flow to ensure everything works correctly.
Update AI instructions in Port
- Go to your context lake page.
- Find a repository entity that has AI instructions defined and edit its content.
- Save the entity to trigger the workflow.
Verify the workflow run
- Go to the Workflows page of your portal.
- Open the latest run of Sync AI instructions and confirm the trigger and dispatch nodes completed successfully.
Verify GitHub pull request
- Check your GitHub repository for a new pull request or Copilot-assigned issue.
- Review the changes to ensure the
AGENTS.mdfile was updated correctly. - Merge the pull request to complete the sync.
Related guides
- Enforce AI coding security standards - Set up comprehensive AI coding security rules.
- Track AI-driven pull requests - Monitor AI agent contributions to your codebase.
- Trigger AI coding assistants from Port - Set up the coding agent backend workflows this guide uses.