Skip to content

Latest commit

ย 

History

13 Commits

Folders and files

NameName
Last commit message
Last commit date
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

formal-spec-driven-dev

Formal Specifications as Contracts for Multi-Agent AI Development


Japanese / ๆ—ฅๆœฌ่ชž

ใƒ“ใ‚ธใƒงใƒณ

AI้ง†ๅ‹•้–‹็™บใซใŠใ„ใฆใ€่ค‡ๆ•ฐใฎใ‚จใƒผใ‚ธใ‚งใƒณใƒˆใŒใƒใƒผใƒ ใฎใ‚ˆใ†ใซๅ”่ชฟใ™ใ‚‹ใŸใ‚ใซใฏไฝ•ใŒๅฟ…่ฆใ‹๏ผŸ

ๅพ“ๆฅใฎใƒ†ใ‚นใƒˆ้ง†ๅ‹•้–‹็™บ๏ผˆTDD๏ผ‰ใฏใ€ๅธฐ็ด็š„ๆŽจ่ซ–ใซๅŸบใฅใ„ใฆใ„ใพใ™ใ€‚ใƒ†ใ‚นใƒˆใ‚ฑใƒผใ‚นใ‚’ๆ›ธใ„ใฆๅฎŸ่ฃ…ใ‚’ๆคœ่จผใ—ใพใ™ใŒใ€ใใ‚Œใฏใ‚ใใพใง็‰นๅฎšใฎใ‚ฑใƒผใ‚นใฎๆญฃๅฝ“ๆ€งใ‚’็คบใ™ใ ใ‘ใงใ™ใ€‚ไธ€ๆ–นใ€ๅฝขๅผไป•ๆง˜๏ผˆFormal Specifications๏ผ‰ใฏๆผ”็นน็š„ๆŽจ่ซ–ใ‚’ๆไพ›ใ—ใพใ™ใ€‚

ๆœฌใƒ—ใƒญใ‚ธใ‚งใ‚ฏใƒˆใฎๆ ธใจใชใ‚‹ไปฎ่ชฌ๏ผš ๅฝขๅผไป•ๆง˜๏ผˆVDM-SL๏ผ‰ใ‚’ใ‚จใƒผใ‚ธใ‚งใƒณใƒˆ้–“ใฎใ€Œๅฅ‘็ด„ใ€ใจใ—ใฆๆฉŸ่ƒฝใ•ใ›ใ‚‹ใ“ใจใงใ€ไปฅไธ‹ใŒๅฎŸ็พใงใใ‚‹๏ผš

  • ่ค‡ๆ•ฐใฎAIใ‚จใƒผใ‚ธใ‚งใƒณใƒˆใŒ็–Ž็ตๅˆใงไธฆ่กŒ้–‹็™บๅฏ่ƒฝ
  • ๅ„ใ‚จใƒผใ‚ธใ‚งใƒณใƒˆใฏ่‡ชๅˆ†ใŒๆ‹…ๅฝ“ใ™ใ‚‹ใƒขใ‚ธใƒฅใƒผใƒซไป•ๆง˜ใจไพๅญ˜ใƒขใ‚ธใƒฅใƒผใƒซใฎใ‚คใƒณใ‚ฟใƒผใƒ•ใ‚งใƒผใ‚นไป•ๆง˜ใฎใฟๅฟ…่ฆ
  • ใƒขใ‚ธใƒฅใƒผใƒซ้–“ใฎไบ’ๆ›ๆ€งใ‚’ๆฉŸๆขฐ็š„ใซๆคœ่จผๅฏ่ƒฝ๏ผˆA.post โ‡’ B.pre ๅˆๆˆๅฏ่ƒฝๆ€ง๏ผ‰
  • ไบบ้–“ใฎๅฝนๅ‰ฒใŒใ€Œใƒ‰ใƒกใ‚คใƒณๅฐ‚้–€ๅฎถ + ใ‚ขใƒผใ‚ญใƒ†ใ‚ฏใƒใƒฃๆฑบๅฎš่€…ใ€ใธใ‚ทใƒ•ใƒˆ
  • ๅฝขๅผ็š„ใชไฟ่จผใซใ‚ˆใ‚Šใ€ใ‚จใƒผใ‚ธใ‚งใƒณใƒˆใŒ็”Ÿๆˆใ—ใŸใ‚ณใƒผใƒ‰ใฎๆญฃๅฝ“ๆ€งใ‚’ๆฉŸๆขฐ็š„ใซๆคœ่จผ

ใ“ใฎใƒชใƒใ‚ธใƒˆใƒชใซใคใ„ใฆ

ๆœฌใƒชใƒใ‚ธใƒˆใƒชใฏใ€ๅฝขๅผไป•ๆง˜้ง†ๅ‹•้–‹็™บใฎใ‚ขใƒ—ใƒญใƒผใƒใ‚’ไฝ“็ณปๅŒ–ใ—ใ€ๅฎŸ่ทตๅฏ่ƒฝใซใ™ใ‚‹ใŸใ‚ใฎๅฎŒๅ…จใชใƒ—ใƒฌใ‚คใƒ–ใƒƒใ‚ฏใงใ™ใ€‚VDM-SLใฎไป•ๆง˜ใƒ†ใƒณใƒ—ใƒฌใƒผใƒˆใ€่ค‡ๆ•ฐใ‚จใƒผใ‚ธใ‚งใƒณใƒˆใ‚’ๅ”่ชฟใ•ใ›ใ‚‹ใƒ—ใƒญใƒณใƒ—ใƒˆใ€ๅฎŸ่ฃ…ไพ‹ใ‚’ๆไพ›ใ—ใพใ™ใ€‚

ๅฏพ่ฑก่€…๏ผš ๆŠ€่ก“ใƒชใƒผใƒ‰ใƒปใ‚ขใƒผใ‚ญใƒ†ใ‚ฏใƒˆใ€AI้ง†ๅ‹•้–‹็™บใฎ่ฉ•ไพกใƒปๅฐŽๅ…ฅใ‚’ๆคœ่จŽใ—ใฆใ„ใ‚‹็ต„็น”

ใ‚ฏใ‚คใƒƒใ‚ฏใ‚นใ‚ฟใƒผใƒˆ๏ผˆ3ใ‚นใƒ†ใƒƒใƒ—๏ผ‰

1. ่ซ–ๆ–‡ใ‚’่ชญใ‚€

ใพใšใฏๅŸบ็คŽใจใชใ‚‹่ซ–ๆ–‡ใ‚’็†่งฃใ—ใฆใใ ใ•ใ„๏ผš

  • ๆ—ฅๆœฌ่ชž็‰ˆ: docs/ja/paper.md - ๅฝขๅผไป•ๆง˜้ง†ๅ‹•้–‹็™บใฎ็†่ซ–ใจๅฎŸ่ทต
  • ่‹ฑ่ชž็‰ˆ: docs/en/paper.md - English full article

่ชญไบ†ๆ™‚้–“: 20-30ๅˆ†

2. ใƒ†ใƒณใƒ—ใƒฌใƒผใƒˆใ‚’่ฉฆใ™

ๆไพ›ใ•ใ‚Œใฆใ„ใ‚‹ใƒ†ใƒณใƒ—ใƒฌใƒผใƒˆใ‚’ไฝฟ็”จใ—ใฆใ€ๅฐ่ฆๆจกใชใƒขใ‚ธใƒฅใƒผใƒซไป•ๆง˜ใ‚’ไฝœๆˆใ—ใฆใฟใฆใใ ใ•ใ„๏ผš

# VDM-SLไป•ๆง˜ใƒ†ใƒณใƒ—ใƒฌใƒผใƒˆใฎ็ขบ่ช
cd templates/vdm-sl/
cat module-template.vdmsl

# AIใƒ—ใƒญใƒณใƒ—ใƒˆใƒ†ใƒณใƒ—ใƒฌใƒผใƒˆใฎ็ขบ่ช
cd templates/prompts/
ls -la

่ฉณ็ดฐใฏ templates/vdm-sl/README.md ใ‚’ๅ‚็…ง

3. ๅฎŸ่ฃ…ไพ‹ใ‚’ๅฎŸ่กŒ

ๅฎŸ้š›ใฎE-commerceใ‚ชใƒผใƒ€ใƒผใ‚ทใ‚นใƒ†ใƒ ใฎไพ‹ใ‚’่ฆ‹ใฆใ€ใƒ—ใƒญใ‚ปใ‚นๅ…จไฝ“ใ‚’็†่งฃใ—ใฆใใ ใ•ใ„๏ผš

cd examples/ec-site-order/
cat README.md

ใ“ใฎใ‚ตใƒณใƒ—ใƒซใงใฏใ€ไปฅไธ‹ใ‚’็ขบ่ชใงใใพใ™๏ผš

  • 3ใคใฎใƒขใ‚ธใƒฅใƒผใƒซ๏ผˆๆณจๆ–‡ใ€ๅœจๅบซใ€ๆฑบๆธˆ๏ผ‰ใฎไป•ๆง˜
  • ๅ„ใ‚จใƒผใ‚ธใ‚งใƒณใƒˆใŒๅ—ใ‘ๅ–ใฃใŸใƒ—ใƒญใƒณใƒ—ใƒˆ
  • VDM-SLใ‹ใ‚‰็”Ÿๆˆใ•ใ‚ŒใŸๅฎŸ่ฃ…ใ‚ณใƒผใƒ‰

ไธป่ฆใชๆฆ‚ๅฟต

ๅฝขๅผไป•ๆง˜ใ‚’ใ€Œๅฅ‘็ด„ใ€ใจใ—ใฆๆฉŸ่ƒฝใ•ใ›ใ‚‹

ใƒขใ‚ธใƒฅใƒผใƒซA                    ใƒขใ‚ธใƒฅใƒผใƒซB
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”               โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ ไบ‹ๅ‰ๆกไปถ   โ”‚               โ”‚ ไบ‹ๅ‰ๆกไปถ   โ”‚
โ”‚ (precond)  โ”‚               โ”‚ (precond)  โ”‚
โ”‚            โ”‚               โ”‚            โ”‚
โ”‚ ไบ‹ๅพŒๆกไปถ   โ”‚โ”€โ”€โ”€ๅฅ‘็ด„โ”€โ”€โ”€โ”€โ”€โ†’โ”‚ ไบ‹ๅ‰ๆกไปถ   โ”‚
โ”‚ (postcond) โ”‚               โ”‚ (precond)  โ”‚
โ”‚            โ”‚    A.post     โ”‚            โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜    โ‡’         โ”‚ ไบ‹ๅพŒๆกไปถ   โ”‚
                   B.pre     โ”‚ (postcond) โ”‚
                             โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

A ใฎไบ‹ๅพŒๆกไปถใŒ B ใฎไบ‹ๅ‰ๆกไปถใ‚’ๆบ€ใŸใ›ใฐใ€ๆฉŸๆขฐ็š„ใซๅˆๆˆๅฏ่ƒฝๆ€งใŒๆคœ่จผใงใใพใ™ใ€‚

ใ‚จใƒผใ‚ธใ‚งใƒณใƒˆใฎๅฝนๅ‰ฒๅˆ†ๆ‹…

  1. ใƒ‰ใƒกใ‚คใƒณๅฐ‚้–€ๅฎถใ‚จใƒผใ‚ธใ‚งใƒณใƒˆ

    • ใƒ“ใ‚ธใƒใ‚น่ฆไปถใ‹ใ‚‰ๅฝขๅผไป•ๆง˜ใ‚’ๅฏพ่ฉฑ็š„ใซๅฐŽๅ‡บ
    • ใƒขใ‚ธใƒฅใƒผใƒซ้–“ใฎใ‚คใƒณใ‚ฟใƒผใƒ•ใ‚งใƒผใ‚น่จญ่จˆ
  2. ๅฎŸ่ฃ…ใ‚จใƒผใ‚ธใ‚งใƒณใƒˆ

    • ๅฝขๅผไป•ๆง˜ใ‚’ไธŽใˆใ‚‰ใ‚Œใฆใ€ๅฎŸ่ฃ…ใ‚’็”Ÿๆˆ
    • ใƒ†ใ‚นใƒˆใ‚ฑใƒผใ‚น็”Ÿๆˆใ‚‚่‡ชๅ‹•ๅŒ–
  3. ๆคœ่จผใ‚จใƒผใ‚ธใ‚งใƒณใƒˆ

    • VDM-SLใ‚นใƒšใƒƒใ‚ฏใฎๅฝขๅผ็š„ๆคœ่จผใ‚’ๅฎŸ่กŒ
    • ไป•ๆง˜้–“ใฎๅˆๆˆๅฏ่ƒฝๆ€งใ‚’็ขบ่ช

TDD vs. ๅฝขๅผไป•ๆง˜้ง†ๅ‹•้–‹็™บ

้ …็›ฎ TDD๏ผˆๅธฐ็ด็š„๏ผ‰ ๅฝขๅผไป•ๆง˜้ง†ๅ‹•๏ผˆๆผ”็นน็š„๏ผ‰
ๆŽจ่ซ–ๆ–นๆณ• ใƒ†ใ‚นใƒˆใ‚ฑใƒผใ‚น โ†’ ๆญฃๅฝ“ๆ€งใฎๅธฐ็ด ไป•ๆง˜ โ†’ ๅฎŸ่ฃ…ใฎๆผ”็นน
ๆคœ่จผใ‚นใ‚ณใƒผใƒ— ใƒ†ใ‚นใƒˆใ‚ฑใƒผใ‚นใŒๅฏพ่ฑกใ™ใ‚‹้ƒจๅˆ† ไป•ๆง˜ๅ…จไฝ“ใ‚’ใ‚ซใƒใƒผ
ใ‚จใƒผใ‚ธใ‚งใƒณใƒˆๅ”่ชฟ ใƒ†ใ‚นใƒˆใ‚’ๅ…ฑๆœ‰ใƒปๅ‚็…ง ไป•ๆง˜ใ‚’ๅ…ฑๆœ‰ใƒปๅ‚็…ง
ใ‚นใ‚ฑใƒผใƒฉใƒ“ใƒชใƒ†ใ‚ฃ ใƒ†ใ‚นใƒˆๆ•ฐใฎๅข—ๅŠ ใซไผดใ†ใƒกใƒณใƒ†ใƒŠใƒณใ‚นใ‚ณใ‚นใƒˆ ไป•ๆง˜ใฎๆ˜Ž็ขบใ•ใซใ‚ˆใ‚‹
ๆฉŸๆขฐ็š„ไฟ่จผ ใชใ— ใ‚ใ‚Š

ใƒชใƒใ‚ธใƒˆใƒชๆง‹ๆˆ

formal-spec-driven-dev/
โ”œโ”€โ”€ README.md                          # ใ“ใฎใƒ•ใ‚กใ‚คใƒซ
โ”œโ”€โ”€ LICENSE                            # Apache 2.0
โ”œโ”€โ”€ CONTRIBUTING.md                    # ่ฒข็Œฎใ‚ฌใ‚คใƒ‰
โ”‚
โ”œโ”€โ”€ docs/
โ”‚   โ”œโ”€โ”€ ja/
โ”‚   โ”‚   โ”œโ”€โ”€ paper.md                   # ่ซ–ๆ–‡๏ผˆๆ—ฅๆœฌ่ชž็‰ˆ๏ผ‰
โ”‚   โ”‚   โ””โ”€โ”€ architecture-guide.md      # ่ค‡ๆ•ฐใ‚จใƒผใ‚ธใ‚งใƒณใƒˆใƒปใ‚ขใƒผใ‚ญใƒ†ใ‚ฏใƒใƒฃใ‚ฌใ‚คใƒ‰
โ”‚   โ”œโ”€โ”€ en/
โ”‚   โ”‚   โ”œโ”€โ”€ paper.md                   # ่ซ–ๆ–‡๏ผˆ่‹ฑ่ชž็‰ˆ๏ผ‰
โ”‚   โ”‚   โ””โ”€โ”€ architecture-guide.md      # Multi-agent Architecture Guide
โ”‚   โ””โ”€โ”€ images/                        # ใƒ€ใ‚คใ‚ขใ‚ฐใƒฉใƒ ็ญ‰
โ”‚
โ”œโ”€โ”€ templates/
โ”‚   โ”œโ”€โ”€ vdm-sl/
โ”‚   โ”‚   โ”œโ”€โ”€ module-template.vdmsl      # ๅ˜ไธ€ใƒขใ‚ธใƒฅใƒผใƒซ็”จใƒ†ใƒณใƒ—ใƒฌใƒผใƒˆ
โ”‚   โ”‚   โ”œโ”€โ”€ interface-contract.vdmsl   # ใƒขใ‚ธใƒฅใƒผใƒซ้–“ๅฅ‘็ด„็”จใƒ†ใƒณใƒ—ใƒฌใƒผใƒˆ
โ”‚   โ”‚   โ””โ”€โ”€ README.md                  # VDM-SLไฝฟ็”จๆ–นๆณ•
โ”‚   โ”‚
โ”‚   โ”œโ”€โ”€ prompts/
โ”‚   โ”‚   โ”œโ”€โ”€ phase1-specification.md    # ใƒ•ใ‚งใƒผใ‚บ1๏ผšไป•ๆง˜ๅฏพ่ฉฑใƒ—ใƒญใƒณใƒ—ใƒˆ
โ”‚   โ”‚   โ”œโ”€โ”€ phase2-design.md           # ใƒ•ใ‚งใƒผใ‚บ2๏ผš่จญ่จˆใƒ—ใƒญใƒณใƒ—ใƒˆ
โ”‚   โ”‚   โ”œโ”€โ”€ phase3-implementation.md   # ใƒ•ใ‚งใƒผใ‚บ3๏ผšๅฎŸ่ฃ…ใƒ—ใƒญใƒณใƒ—ใƒˆ
โ”‚   โ”‚   โ””โ”€โ”€ phase4-verification.md     # ใƒ•ใ‚งใƒผใ‚บ4๏ผšๆคœ่จผใƒ—ใƒญใƒณใƒ—ใƒˆ
โ”‚   โ”‚
โ”‚   โ””โ”€โ”€ orchestration/
โ”‚       โ”œโ”€โ”€ agent-config.yaml          # ใ‚จใƒผใ‚ธใ‚งใƒณใƒˆๅฝนๅ‰ฒๅฎš็พฉ
โ”‚       โ””โ”€โ”€ workflow.md                # ใ‚ชใƒผใ‚ฑใ‚นใƒˆใƒฌใƒผใ‚ทใƒงใƒณใƒฏใƒผใ‚ฏใƒ•ใƒญใƒผ
โ”‚
โ”œโ”€โ”€ examples/
โ”‚   โ””โ”€โ”€ ec-site-order/
โ”‚       โ”œโ”€โ”€ README.md                  # ใ“ใฎใ‚ตใƒณใƒ—ใƒซใฎ่ชฌๆ˜Ž
โ”‚       โ”œโ”€โ”€ .vdm/                      # VDM-SLไป•ๆง˜ใƒ•ใ‚กใ‚คใƒซ
โ”‚       โ”‚   โ”œโ”€โ”€ order-module.vdmsl
โ”‚       โ”‚   โ”œโ”€โ”€ inventory-module.vdmsl
โ”‚       โ”‚   โ””โ”€โ”€ payment-module.vdmsl
โ”‚       โ””โ”€โ”€ prompts/                   # ๅฎŸ้š›ใซไฝฟ็”จใ—ใŸใƒ—ใƒญใƒณใƒ—ใƒˆ
โ”‚
โ””โ”€โ”€ .github/
    โ””โ”€โ”€ ISSUE_TEMPLATE/                # Issue ใƒ†ใƒณใƒ—ใƒฌใƒผใƒˆ

่ฒข็Œฎๆ–นๆณ•

ใ“ใฎใƒ—ใƒญใ‚ธใ‚งใ‚ฏใƒˆใธใฎ่ฒข็Œฎใ‚’ๆญ“่ฟŽใ—ใพใ™ใ€‚ไปฅไธ‹ใฎๆ–นๆณ•ใงใ”ๅ‚ๅŠ ใใ ใ•ใ„๏ผš

  1. ใƒ•ใ‚ฃใƒผใƒ‰ใƒใƒƒใ‚ฏใƒปๆ„่ฆ‹ๆๆกˆ

    • GitHub Issues ใงๆฉŸ่ƒฝๆๆกˆใƒปใƒใ‚ฐๅ ฑๅ‘Šใ‚’ไฝœๆˆ
  2. ใƒ‰ใ‚ญใƒฅใƒกใƒณใƒˆๆ”นๅ–„

    • ๆ—ฅๆœฌ่ชžใƒป่‹ฑ่ชžใฎๆ–‡็ซ ๆ”นๅ–„ใ€ไพ‹ใฎ่ฟฝๅŠ 
  3. ๆ–ฐใ—ใ„ใƒ†ใƒณใƒ—ใƒฌใƒผใƒˆใƒปไพ‹ใฎๆไพ›

    • ็•ฐใชใ‚‹ใƒ‰ใƒกใ‚คใƒณใฎVDM-SLใƒ†ใƒณใƒ—ใƒฌใƒผใƒˆ
    • ๆ–ฐใ—ใ„ใƒ—ใƒญใƒณใƒ—ใƒˆใƒ‘ใ‚ฟใƒผใƒณ
  4. ๅฎŸ่ฃ…ใธใฎๅ”ๅŠ›

    • ๆคœ่จผใƒ„ใƒผใƒซใฎๆ”นๅ–„
    • ใ‚ชใƒผใ‚ฑใ‚นใƒˆใƒฌใƒผใ‚ทใƒงใƒณๆฉŸ่ƒฝใฎๆ‹กๅผต

่ฉณ็ดฐใฏ CONTRIBUTING.md ใ‚’ๅ‚็…งใ—ใฆใใ ใ•ใ„ใ€‚

ใƒฉใ‚คใ‚ปใƒณใ‚น

ใ“ใฎใƒ—ใƒญใ‚ธใ‚งใ‚ฏใƒˆใฏ Apache License 2.0 ใฎไธ‹ใงๅ…ฌ้–‹ใ•ใ‚Œใฆใ„ใพใ™ใ€‚ ่ฉณ็ดฐใฏ LICENSE ใ‚’ๅ‚็…งใ—ใฆใใ ใ•ใ„ใ€‚

้–ข้€ฃใƒชใƒณใ‚ฏ

  • ่ซ–ๆ–‡๏ผˆๆ—ฅๆœฌ่ชž๏ผ‰: docs/ja/paper.md
  • ่ซ–ๆ–‡๏ผˆ่‹ฑ่ชž๏ผ‰: docs/en/paper.md
  • Claude CodeๅฎŸ่ทตใ‚ฌใ‚คใƒ‰: docs/claude-code-integration.md โ€” CLAUDE.mdใฎ้šŽๅฑคๆง‹้€ ใ‚’ๆดป็”จใ—ใŸๅ…ทไฝ“็š„ใช้–‹็™บๆ–นๆณ•
  • ใƒžใƒซใƒใ‚จใƒผใ‚ธใ‚งใƒณใƒˆใƒปใ‚ขใƒผใ‚ญใƒ†ใ‚ฏใƒใƒฃใ‚ฌใ‚คใƒ‰๏ผˆๆ—ฅๆœฌ่ชž๏ผ‰: docs/ja/architecture-guide.md
  • ใƒžใƒซใƒใ‚จใƒผใ‚ธใ‚งใƒณใƒˆใƒปใ‚ขใƒผใ‚ญใƒ†ใ‚ฏใƒใƒฃใ‚ฌใ‚คใƒ‰๏ผˆ่‹ฑ่ชž๏ผ‰: docs/en/architecture-guide.md
  • VDM-SLใƒ†ใƒณใƒ—ใƒฌใƒผใƒˆไฝฟ็”จๆ–นๆณ•: templates/vdm-sl/README.md

่‘—่€…

Hikaru Ando (ๅฎ‰่—คๅ…‰ๅคช้ƒŽ) (ando@iid.systems) IID Systems


English

Vision

What does it take for multiple AI agents to collaborate like a development team?

Traditional Test-Driven Development (TDD) relies on inductive reasoning. Writing test cases validates an implementation, but only for specific scenarios. Formal specifications, by contrast, provide deductive reasoning.

The core hypothesis of this project: By making formal specifications (VDM-SL) function as "contracts" between agents, we can achieve:

  • Multiple AI agents developing in parallel with loose coupling
  • Each agent needing only their own module spec and dependent module interface specs
  • Mechanical verification of module compatibility (A.post โ‡’ B.pre composability)
  • A shift in human roles to "domain expert + architecture decision maker"
  • Formal guarantees enabling mechanical verification of agent-generated code

About This Repository

This repository systematizes the formal-specification-driven development approach and makes it practically deployable. It provides VDM-SL specification templates, prompts for coordinating multiple agents, and working examples.

Intended for: Tech leads and architects evaluating and adopting AI-driven development within their organizations

Quick Start (3 Steps)

1. Read the Paper

First, understand the foundational theory:

Reading time: 20-30 minutes

2. Try the Templates

Use the provided templates to create a small module specification:

# Review VDM-SL specification templates
cd templates/vdm-sl/
cat module-template.vdmsl

# Review AI prompt templates
cd templates/prompts/
ls -la

Details available in templates/vdm-sl/README.md

3. Run the Example

Examine the e-commerce order system example to understand the entire process:

cd examples/ec-site-order/
cat README.md

The sample demonstrates:

  • Specifications for three modules (order, inventory, payment)
  • Actual prompts given to each agent
  • Implementation code generated from VDM-SL specs

Key Concepts

Formal Specifications as Contracts

Module A                       Module B
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”               โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ Preconditionโ”‚               โ”‚ Preconditionโ”‚
โ”‚ (precond)   โ”‚               โ”‚ (precond)   โ”‚
โ”‚             โ”‚               โ”‚             โ”‚
โ”‚ Postcondition           โ”€โ”€โ†’โ”‚ Preconditionโ”‚
โ”‚ (postcond)  โ”‚โ”€โ”€โ”€Contract    โ”‚ (precond)   โ”‚
โ”‚             โ”‚    A.post โ‡’   โ”‚             โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜    B.pre     โ”‚ Postcondition
                             โ”‚ (postcond)  โ”‚
                             โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

When A's postcondition satisfies B's precondition, mechanical composability verification becomes possible.

Agent Role Distribution

  1. Domain Expert Agent

    • Derives formal specifications from business requirements through dialogue
    • Designs module interfaces
  2. Implementation Agent

    • Generates implementation from formal specs
    • Automates test case generation
  3. Verification Agent

    • Executes formal verification of VDM-SL specs
    • Confirms composability between specs

TDD vs. Formal-Specification-Driven Development

Aspect TDD (Inductive) Formal-Spec-Driven (Deductive)
Reasoning Test cases โ†’ Inductive proof Spec โ†’ Deductive implementation
Verification scope Only tested cases Entire specification
Agent coordination Shared test suite Shared specification
Scalability Test maintenance overhead Specification clarity
Mechanical guarantee None Yes

Repository Structure

formal-spec-driven-dev/
โ”œโ”€โ”€ README.md                          # This file
โ”œโ”€โ”€ LICENSE                            # Apache 2.0
โ”œโ”€โ”€ CONTRIBUTING.md                    # Contribution Guidelines
โ”‚
โ”œโ”€โ”€ docs/
โ”‚   โ”œโ”€โ”€ ja/
โ”‚   โ”‚   โ”œโ”€โ”€ paper.md                   # Paper (Japanese)
โ”‚   โ”‚   โ””โ”€โ”€ architecture-guide.md      # Multi-agent Architecture Guide (JP)
โ”‚   โ”œโ”€โ”€ en/
โ”‚   โ”‚   โ”œโ”€โ”€ paper.md                   # Paper (English)
โ”‚   โ”‚   โ””โ”€โ”€ architecture-guide.md      # Multi-agent Architecture Guide (EN)
โ”‚   โ””โ”€โ”€ images/                        # Diagrams and illustrations
โ”‚
โ”œโ”€โ”€ templates/
โ”‚   โ”œโ”€โ”€ vdm-sl/
โ”‚   โ”‚   โ”œโ”€โ”€ module-template.vdmsl      # Single module template
โ”‚   โ”‚   โ”œโ”€โ”€ interface-contract.vdmsl   # Inter-module contract template
โ”‚   โ”‚   โ””โ”€โ”€ README.md                  # How to use VDM-SL templates
โ”‚   โ”‚
โ”‚   โ”œโ”€โ”€ prompts/
โ”‚   โ”‚   โ”œโ”€โ”€ phase1-specification.md    # Phase 1: Specification dialogue prompt
โ”‚   โ”‚   โ”œโ”€โ”€ phase2-design.md           # Phase 2: Design prompt
โ”‚   โ”‚   โ”œโ”€โ”€ phase3-implementation.md   # Phase 3: Implementation prompt
โ”‚   โ”‚   โ””โ”€โ”€ phase4-verification.md     # Phase 4: Verification prompt
โ”‚   โ”‚
โ”‚   โ””โ”€โ”€ orchestration/
โ”‚       โ”œโ”€โ”€ agent-config.yaml          # Agent role definitions
โ”‚       โ””โ”€โ”€ workflow.md                # Orchestration workflow guide
โ”‚
โ”œโ”€โ”€ examples/
โ”‚   โ””โ”€โ”€ ec-site-order/
โ”‚       โ”œโ”€โ”€ README.md                  # This example explained
โ”‚       โ”œโ”€โ”€ .vdm/                      # VDM-SL specification files
โ”‚       โ”‚   โ”œโ”€โ”€ order-module.vdmsl
โ”‚       โ”‚   โ”œโ”€โ”€ inventory-module.vdmsl
โ”‚       โ”‚   โ””โ”€โ”€ payment-module.vdmsl
โ”‚       โ””โ”€โ”€ prompts/                   # Actual prompts used
โ”‚
โ””โ”€โ”€ .github/
    โ””โ”€โ”€ ISSUE_TEMPLATE/                # Issue templates

How to Contribute

We welcome contributions to this project. You can participate in the following ways:

  1. Feedback and Suggestions

    • Create issues for feature requests or bug reports on GitHub
  2. Documentation Improvements

    • Improve Japanese and English documentation
    • Add examples and clarifications
  3. New Templates and Examples

    • Provide VDM-SL templates for different domains
    • Contribute new prompt patterns
  4. Implementation Support

    • Improve verification tools
    • Enhance orchestration features

See CONTRIBUTING.md for detailed guidelines.

License

This project is released under the Apache License 2.0. See LICENSE for details.

Related Links

Author

Hikaru Ando (ๅฎ‰่—คๅ…‰ๅคช้ƒŽ) (ando@iid.systems) IID Systems


Made with commitment to formal methods and AI-driven development.

About

Formal specifications as contracts for multi-agent AI development

Resources

Contributing

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors